From patchwork Mon Feb 24 22:19:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3, of, 7] localrepo: commit: avoid calling expensive ancestor function when p1 is nullrev From: Mads Kiilerich X-Patchwork-Id: 3747 Message-Id: <15f7ab614d3c52788095.1393280352@mk-desktop> To: mercurial-devel@selenic.com Date: Mon, 24 Feb 2014 23:19:12 +0100 # HG changeset patch # User Mads Kiilerich # 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)