diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -594,16 +594,15 @@ return srcpeer, peer(ui, peeropts, dest) -# Recomputing branch cache might be slow on big repos, -# so just copy it +# Recomputing caches is often slow on big repos, so copy them. def _copycache(srcrepo, dstcachedir, fname): """copy a cache from srcrepo to destcachedir (if it exists)""" - srcbranchcache = srcrepo.vfs.join(b'cache/%s' % fname) - dstbranchcache = os.path.join(dstcachedir, fname) - if os.path.exists(srcbranchcache): + srcfname = srcrepo.cachevfs.join(fname) + dstfname = os.path.join(dstcachedir, fname) + if os.path.exists(srcfname): if not os.path.exists(dstcachedir): os.mkdir(dstcachedir) - util.copyfile(srcbranchcache, dstbranchcache) + util.copyfile(srcfname, dstfname) def clone( diff --git a/tests/test-share.t b/tests/test-share.t --- a/tests/test-share.t +++ b/tests/test-share.t @@ -56,6 +56,17 @@ rbc-revs-v1 tags2-visible +Cloning a shared repo should pick up the full cache dir on the other hand. + + $ hg clone . ../repo2-clone + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ ls -1 ../repo2-clone/.hg/cache + branch2-served + rbc-names-v1 + rbc-revs-v1 + tags2-visible + Some sed versions appends newline, some don't, and some just fails $ cat .hg/sharedpath; echo