Message9486

Author friedrich
Recipients astratto, jcoomes
Date 2009-06-11.00:00:34
Content
I located the problem:

% hg version
Mercurial Distributed SCM (version 1.2.1)

% sh rebase_merge.sh
[...]
rebasing 2:7e1afe9214b2
 future parents are 4 and -1
 already in target
 merge against 2:7e1afe9214b2
resolving manifests
 overwrite False partial False
 ancestor 0a6620c3c26a local 0b69665d48b4+ remote 7e1afe9214b2
  searching for copies back to rev 1
 a: versions differ -> m
preserving a for resolve of a
couldn't find merge tool hgmerge
picked tool 'internal:merge' for a (binary False symlink False)
merging a
my a@0b69665d48b4+ other a@7e1afe9214b2 ancestor a@1e635d440a73
warning: conflicts during merge.
merging a failed!

and

% hg -R testrepo glog          
@  3[tip]:0   66559d44c7db   1970-01-01 00:00 +0000   test
|    D
|
| o  2   7e1afe9214b2   1970-01-01 00:00 +0000   test
| |    C
| |
| o  1   0a6620c3c26a   1970-01-01 00:00 +0000   test
|/     B
|
o  0   1e635d440a73   1970-01-01 00:00 +0000   test
     A

At the line

  ancestor 0a6620c3c26a local 0b69665d48b4+ remote 7e1afe9214b2

the ancastor is right. But at the merge

  my a@0b69665d48b4+ other a@7e1afe9214b2 ancestor a@1e635d440a73

the ancastor is wrong! The cause is in hgext/rebase.py line 23 (introduced
in 45495d784ad6):

...
def rebasemerge(repo, rev, first=False):
    'return the correct ancestor'
    oldancestor = ancestor.ancestor

    def newancestor(a, b, pfunc):
        ancestor.ancestor = oldancestor
        anc = ancestor.ancestor(a, b, pfunc)
        if b == rev:
            return repo[rev].parents()[0].rev()
        return ancestor.ancestor(a, b, pfunc)

    if not first:
        ancestor.ancestor = newancestor
    else:
        repo.ui.debug(_("first revision, do not change ancestor\n"))
...

The design idea at line 30:

  if b == rev:

is right but the implemtation is buggy because 'b' could be a normal 
rev (thats ok), like in mercurial/revlog.py line 1106:

  c = ancestor.ancestor(self.rev(a), self.rev(b), parents)

But 'b' could also be a tuple (that's bad), like in mercurial/context.py
line 463:

  a, b = (self._path, self._filenode), (fc2._path, fc2._filenode)
  v = ancestor.ancestor(a, b, parents)

Any idea?
History
Date User Action Args
2009-06-11 00:00:36friedrichsetrecipients: + jcoomes, astratto
2009-06-11 00:00:36friedrichsetmessageid: <1244678436.53.0.29691885486.issue1561@selenic.com>
2009-06-11 00:00:36friedrichlinkissue1561 messages
2009-06-11 00:00:34friedrichcreate