[PATCH 4 of 8 ancestor-ish] commit: use revlog.commonancestors instead of .ancestor

Mads Kiilerich mads at kiilerich.com
Mon Apr 7 16:18:20 CDT 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1396905471 -7200
#      Mon Apr 07 23:17:51 2014 +0200
# Node ID 5b26b4e1f0815671b336bbe8680361ede2e8473b
# Parent  c13578458af167096db83403c84d17fcac05202c
commit: use revlog.commonancestors instead of .ancestor

This do probably not make any real difference but is slightly more correct and
we would like to get rid of flog.ancestor.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1145,10 +1145,10 @@ class localrepository(object):
             fparent1, fparent2 = fparent2, nullid
         elif fparent2 != nullid:
             # is one parent an ancestor of the other?
-            fparentancestor = flog.ancestor(fparent1, fparent2)
-            if fparentancestor == fparent1:
+            fparentancestors = flog.commonancestors(fparent1, fparent2)
+            if fparent1 in fparentancestors:
                 fparent1, fparent2 = fparent2, nullid
-            elif fparentancestor == fparent2:
+            elif fparent2 in fparentancestors:
                 fparent2 = nullid
 
         # is the file changed?


More information about the Mercurial-devel mailing list