Comments
Patch
@@ -402,8 +402,18 @@ class changectx(basectx):
n2 = c2._node
if n2 is None:
n2 = c2._parents[0]._node
- n = self._repo.changelog.ancestor(self._node, n2)
- return changectx(self._repo, n)
+ ancs = self._repo.changelog.commonancestorsheads(self._node, n2)
+ if not ancs:
+ anc = nullid
+ elif len(ancs) == 1:
+ anc = ancs[0]
+ else:
+ anc = self._repo.changelog.ancestor(self._node, n2)
+ self._repo.ui.status(
+ _("note: %s is best ancestor of %s and %s, not %s\n") %
+ (short(anc), short(self._node), short(n2),
+ ' '.join(short(n) for n in sorted(ancs) if n != anc)))
+ return changectx(self._repo, anc)
def descendant(self, other):
"""True if other is descendant of this changeset"""
@@ -23,7 +23,9 @@ Criss cross merging
$ echo '5 second change' > f1
$ hg ci -m '5 second change f1'
- $ hg up -qr3
+ $ hg up -r3
+ note: 0f6b37dbe527 is best ancestor of adfe50279922 and cf89f02107e5, not 40663881a6dd
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo '6 second change' > f2
$ hg ci -m '6 second change f2'
@@ -72,6 +74,7 @@ Criss cross merging
$ hg merge -v --debug --tool internal:dump 5
+ note: 0f6b37dbe527 is best ancestor of 3b08d01b0ab5 and adfe50279922, not 40663881a6dd
searching for copies back to rev 3
resolving manifests
branchmerge: True, force: False, partial: False