##// END OF EJS Templates
clone: for local clones, copy over filtered branchcaches as well (issue4286)...
Siddharth Agarwal -
r22264:4bc1fd86 default
parent child Browse files
Show More
@@ -11,7 +11,7 b' from lock import release'
11 11 from node import hex, nullid
12 12 import localrepo, bundlerepo, unionrepo, httppeer, sshpeer, statichttprepo
13 13 import bookmarks, lock, util, extensions, error, node, scmutil, phases, url
14 import cmdutil, discovery
14 import cmdutil, discovery, repoview
15 15 import merge as mergemod
16 16 import verify as verifymod
17 17 import errno, os, shutil
@@ -366,13 +366,20 b' def clone(ui, peeropts, source, dest=Non'
366 366
367 367 # Recomputing branch cache might be slow on big repos,
368 368 # so just copy it
369 def copybranchcache(fname):
370 srcbranchcache = srcrepo.join('cache/%s' % fname)
371 dstbranchcache = os.path.join(dstcachedir, fname)
372 if os.path.exists(srcbranchcache):
373 if not os.path.exists(dstcachedir):
374 os.mkdir(dstcachedir)
375 util.copyfile(srcbranchcache, dstbranchcache)
376
369 377 dstcachedir = os.path.join(destpath, 'cache')
370 srcbranchcache = srcrepo.join('cache/branch2')
371 dstbranchcache = os.path.join(dstcachedir, 'branch2')
372 if os.path.exists(srcbranchcache):
373 if not os.path.exists(dstcachedir):
374 os.mkdir(dstcachedir)
375 util.copyfile(srcbranchcache, dstbranchcache)
378 # In local clones we're copying all nodes, not just served
379 # ones. Therefore copy all branchcaches over.
380 copybranchcache('branch2')
381 for cachename in repoview.filtertable:
382 copybranchcache('branch2-%s' % cachename)
376 383
377 384 # we need to re-init the repo after manually copying the data
378 385 # into it
@@ -25,12 +25,25 b' List files in store/data (should show a '
25 25 .hg/store/data/b.d
26 26 .hg/store/data/b.i
27 27
28 Trigger branchcache creation:
29
30 $ hg branches
31 default 10:a7949464abda
32 $ ls .hg/cache
33 branch2-served
34
28 35 Default operation:
29 36
30 37 $ hg clone . ../b
31 38 updating to branch default
32 39 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 40 $ cd ../b
41
42 Ensure branchcache got copied over:
43
44 $ ls .hg/cache
45 branch2-served
46
34 47 $ cat a
35 48 a
36 49 $ hg verify
@@ -58,6 +71,12 b' No update, with debug option:'
58 71 listing keys for "bookmarks"
59 72 #endif
60 73 $ cd ../c
74
75 Ensure branchcache got copied over:
76
77 $ ls .hg/cache
78 branch2-served
79
61 80 $ cat a 2>/dev/null || echo "a not present"
62 81 a not present
63 82 $ hg verify
General Comments 0
You need to be logged in to leave comments. Login now