[PATCH 0 of 2 STABLE] annotation: fix problems in the tree merging a revision and its ancestor

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Thu Mar 28 11:08:22 CDT 2013


At Thu, 28 Mar 2013 16:09:18 +0400,
Alexander Drozdov wrote:
> 
> 28.03.2013 15:48, FUJIWARA Katsunori wrote:
> >
> > As describing in each patch descriptions, issue3841 occurs only on
> > repositories which include the revision merging a revision and its
> > ancestor, and recent Mercurial doesn't allow such merging.
> >
> > So, there is no easy way to build the repository to examine validity
> > of these patches.
> 
> I often use the simple script to group patch series with recent version of Mercurial:
> 
> #!/bin/sh
> 
> MASTER=$1
> FEATURE=$2
> ANCESTOR=`hg log -q -r $MASTER\ and\ not\ ancestor\($MASTER\,\ $FEATURE\)`
> 
> hg purge
> if [ -n "$ANCESTOR" ]; then
>          hg up $MASTER && hg merge -r $FEATURE
> else
>          hg up $MASTER && hg debugsetparents $MASTER $FEATURE && hg revert -a -r $FEATURE
> fi

Thank you for your suggestion, Alexander. 

I've forgotten about "hg debugsetparents".

Using "hg debugsetparents" (+ any modification on target file) can
create expected result in "00changelog.i" and "00manifest.i" under
".hg/store": merging a revision and its ancestor.

But as far as I tried, it can't create expected result in filelog of
target file.

In "localrepository._filecommit()", second parent is ignored just
before creating new entry into filelog, if one of parents is an
ancestor of the other:

        elif fparent2 != nullid:
            # is one parent an ancestor of the other?
            fparentancestor = flog.ancestor(fparent1, fparent2)
            if fparentancestor == fparent1:
                fparent1, fparent2 = fparent2, nullid
            elif fparentancestor == fparent2:
                fparent2 = nullid

    http://selenic.com/repo/hg/file/fabbaa250977/mercurial/localrepo.py#l1109

But I got an idea to create issue3841 specific extension: it overrides
"repo._filecommit()" and avoids ignoring second parent shown above.

With quick implemented extension, I can reproduce the required
situtation.

I'll re-post this patch series with tests.

----------------------------------------------------------------------
[FUJIWARA Katsunori]                             foozy at lares.dti.ne.jp


More information about the Mercurial-devel mailing list