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

login
register
mail settings
Submitter Mads Kiilerich
Date Feb. 24, 2014, 10:19 p.m.
Message ID <15f7ab614d3c52788095.1393280352@mk-desktop>
Download mbox | patch
Permalink /patch/3747/
State Accepted
Commit db0740a487ab1adc0d3c3c126de0b3915528fce1
Headers show

Comments

Mads Kiilerich - Feb. 24, 2014, 10:19 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@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

Patch

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)