Patchwork [2,of,2] merge: don't call copies.mergecopies unless we need to

mail settings
Submitter Bryan O'Sullivan
Date Feb. 9, 2013, 9:23 p.m.
Message ID <53956d5e085898c0b6fe.1360444986@australite.local>
Download mbox | patch
Permalink /patch/908/
State Superseded
Commit d9ff580fcaa26199ab8d76f35f81169431ce84b3
Headers show


Bryan O'Sullivan - Feb. 9, 2013, 9:23 p.m.
# HG changeset patch
# User Bryan O'Sullivan <>
# Date 1360444976 0
# Node ID 53956d5e085898c0b6fe4ec1159f4706dfbc1baa
# Parent  68226cb20b4ad583c3bdf54044c59ea979ec6e7f
merge: don't call copies.mergecopies unless we need to

This reduces the amount of time we spend calculating when doing a clean
non-merge update. In a large repo, the time dropped from 10.1 seconds
to 3.4.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -200,6 +200,8 @@  def manifestmerge(repo, wctx, p2, pa, br
         pa = wctx
     elif pa == p2: # backwards
         pa = wctx.p1()
+    elif not branchmerge and not wctx.dirty(missing=True):
+        pass
     elif pa and repo.ui.configbool("merge", "followcopies", True):
         ret = copies.mergecopies(repo, wctx, p2, pa)
         copy, movewithdir, diverge, renamedelete = ret
diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
--- a/tests/test-subrepo.t
+++ b/tests/test-subrepo.t
@@ -210,7 +210,6 @@  merge tests
   subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
     subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg
   getting subrepo t
-    searching for copies back to rev 1
   resolving manifests
    branchmerge: False, force: False, partial: False
    ancestor: 60ca1237c194, local: 60ca1237c194+, remote: 6747d179aa9a