[PATCH 5 of 9 cah] backout: use commonancestorsheads for checking linear heritage

Mads Kiilerich mads at kiilerich.com
Thu Apr 17 13:07:57 CDT 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1397757699 -7200
#      Thu Apr 17 20:01:39 2014 +0200
# Node ID 12312f066d93dcfa2e50e8c9a9f05989ebbbc719
# Parent  40ace21cb3a1716c8c686874dcbca47a53a84964
backout: use commonancestorsheads for checking linear heritage

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.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -438,7 +438,7 @@ def backout(ui, repo, node=None, rev=Non
     node = scmutil.revsingle(repo, rev).node()
 
     op1, op2 = repo.dirstate.parents()
-    if node not in repo.changelog.commonancestors(op1, node):
+    if node not in repo.changelog.commonancestorsheads(op1, node):
         raise util.Abort(_('cannot backout change that is not an ancestor'))
 
     p1, p2 = repo.changelog.parents(node)


More information about the Mercurial-devel mailing list