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