Patchwork [3,of,3,V2] manifestmerge: fix order in which manifests are fetched

login
register
mail settings
Submitter Siddharth Agarwal
Date Feb. 10, 2013, 4:57 p.m.
Message ID <37777a929dc6945b3ac7.1360515456@sid0x220>
Download mbox | patch
Permalink /patch/939/
State Superseded
Commit d9ff580fcaa26199ab8d76f35f81169431ce84b3
Headers show

Comments

Siddharth Agarwal - Feb. 10, 2013, 4:57 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1360515301 0
# Node ID 37777a929dc6945b3ac7718649a84ecf10d7e0ac
# Parent  fad0293bfdb045488c2b65b6448da54628ada8e5
manifestmerge: fix order in which manifests are fetched

If the manifest of an earlier revision on the same delta chain is read before
that of a later revision, the revlog remembers that we parsed the earlier
revision and continues applying deltas from there onwards. If manifests are
parsed the other way round, we have to start over from the fulltext.

For a fresh clone of mozilla-central, updating from 29dd80c95b7d to its parent
aab96936a177 requires approximately 400 fewer zlib.decompress calls, which
results in a speedup from 1.10 seconds to 1.05.
Bryan O'Sullivan - Feb. 10, 2013, 11:39 p.m.
On Sun, Feb 10, 2013 at 8:57 AM, Siddharth Agarwal <sid0@fb.com> wrote:

> manifestmerge: fix order in which manifests are fetched
>

Series crewed, thanks.

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -196,6 +196,7 @@  def manifestmerge(repo, wctx, p2, pa, br
     overwrite = force and not branchmerge
     actions, copy, movewithdir = [], {}, {}
 
+    followcopies = False
     if overwrite:
         pa = wctx
     elif pa == p2: # backwards
@@ -203,6 +204,13 @@  def manifestmerge(repo, wctx, p2, pa, br
     elif not branchmerge and not wctx.dirty(missing=True):
         pass
     elif pa and repo.ui.configbool("merge", "followcopies", True):
+        followcopies = True
+
+    # manifests fetched in order are going to be faster, so prime the caches
+    [x.manifest() for x in
+     sorted(wctx.parents() + [p2, pa], key=lambda x: x.rev())]
+
+    if followcopies:
         ret = copies.mergecopies(repo, wctx, p2, pa)
         copy, movewithdir, diverge, renamedelete = ret
         for of, fl in diverge.iteritems():