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

login
register
mail settings
Submitter Mads Kiilerich
Date April 7, 2014, 9:18 p.m.
Message ID <5b26b4e1f0815671b336.1396905500@mk-desktop>
Download mbox | patch
Permalink /patch/4259/
State Accepted
Commit 298c9f346dde7300f99d3806d6b1631dd8d4f71f
Headers show

Comments

Mads Kiilerich - April 7, 2014, 9:18 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@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.

Patch

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?