diff mercurial/localrepo.py @ 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 6b4c789d618d
children de8eb208b7d0
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)