[PATCH 3 of 7] localrepo: commit: avoid calling expensive ancestor function when p1 is nullrev

Mads Kiilerich mads at kiilerich.com
Mon Feb 24 16:19:12 CST 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1393278134 -3600
#      Mon Feb 24 22:42:14 2014 +0100
# Node ID 15f7ab614d3c5278809575c7e577b4648b85f832
# Parent  b4a5e8ed29c32284842d7786dfbb039712fbe24f
localrepo: commit: avoid calling expensive ancestor function when p1 is nullrev

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1123,6 +1123,8 @@
                 self.ui.warn(_("warning: can't find ancestor for '%s' "
                                "copied from '%s'!\n") % (fname, cfname))
 
+        elif fparent1 == nullid:
+            fparent1, fparent2 = fparent2, nullid
         elif fparent2 != nullid:
             # is one parent an ancestor of the other?
             fparentancestor = flog.ancestor(fparent1, fparent2)


More information about the Mercurial-devel mailing list