Patchwork [3,of,4] local-clone: also copy revs-branch-cache files

login
register
mail settings
Submitter Pierre-Yves David
Date May 25, 2017, 10:56 a.m.
Message ID <2d5c478a7511cea26f11.1495709772@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/20895/
State Accepted
Headers show

Comments

Pierre-Yves David - May 25, 2017, 10:56 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1495706733 -7200
#      Thu May 25 12:05:33 2017 +0200
# Node ID 2d5c478a7511cea26f1177b4842264c40b679f3f
# Parent  92bfcf826e4613c6d80afce8b6e3cad37539ca69
# EXP-Topic clone-caches
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 2d5c478a7511
local-clone: also copy revs-branch-cache files

This cache provides a large speedup for some repositories. Keeping it around is
valuable.

Patch

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -425,7 +425,8 @@  def _cachetocopy(srcrepo):
     # In local clones we're copying all nodes, not just served
     # ones. Therefore copy all branch caches over.
     cachefiles = ['branch2']
-    cachefiles.extend('branch2-%s' % f for f in repoview.filtertable)
+    cachefiles += ['branch2-%s' % f for f in repoview.filtertable]
+    cachefiles += ['rbc-names-v1', 'rbc-revs-v1']
     return cachefiles
 
 def clone(ui, peeropts, source, dest=None, pull=False, rev=None,
diff --git a/tests/test-clone.t b/tests/test-clone.t
--- a/tests/test-clone.t
+++ b/tests/test-clone.t
@@ -52,6 +52,8 @@  Ensure branchcache got copied over:
   checkisexec (execbit !)
   checklink (symlink !)
   checklink-target (symlink !)
+  rbc-names-v1
+  rbc-revs-v1
 
   $ cat a
   a
@@ -99,6 +101,8 @@  Ensure branchcache got copied over:
 
   $ ls .hg/cache
   branch2-served
+  rbc-names-v1
+  rbc-revs-v1
 
   $ cat a 2>/dev/null || echo "a not present"
   a not present