changeset 20556:db0740a487ab

localrepo: commit: avoid calling expensive ancestor function when p1 is nullrev
author Mads Kiilerich <madski@unity3d.com>
date Mon, 24 Feb 2014 22:42:14 +0100
parents 4add43865a9b
children 514d32de6646
files mercurial/localrepo.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)