localrepo: commit: avoid calling expensive ancestor function when p1 is nullrev
authorMads Kiilerich <madski@unity3d.com>
Mon, 24 Feb 2014 22:42:14 +0100
changeset 20556 db0740a487ab
parent 20555 4add43865a9b
child 20557 514d32de6646
localrepo: commit: avoid calling expensive ancestor function when p1 is nullrev
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Mon Feb 24 22:42:13 2014 +0100
+++ b/mercurial/localrepo.py	Mon Feb 24 22:42:14 2014 +0100
@@ -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)