Patchwork [6,of,9,cah] localrepo: use commonancestorsheads for checking linear heritage in file commit

login
register
mail settings
Submitter Mads Kiilerich
Date April 17, 2014, 6:07 p.m.
Message ID <53433d8f1faa14193e5d.1397758078@localhost.localdomain>
Download mbox | patch
Permalink /patch/4400/
State Accepted
Commit 53433d8f1faa14193e5d6eb2f669f85072065cd1
Headers show

Comments

Mads Kiilerich - April 17, 2014, 6:07 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1397757699 -7200
#      Thu Apr 17 20:01:39 2014 +0200
# Node ID 53433d8f1faa14193e5d6eb2f669f85072065cd1
# Parent  12312f066d93dcfa2e50e8c9a9f05989ebbbc719
localrepo: use commonancestorsheads for checking linear heritage in file commit

If two revisions are linearly related, there will only be one ancestor, and
commonancestors and commonancestorsheads would give the same result.
commonancestorsheads is however slightly simpler, faster and more correct.

Patch

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