[Updated] D9598: share: properly copy cache files when cloning from a share
joerg.sonnenberger (Joerg Sonnenberger)
phabricator at mercurial-scm.org
Thu Dec 17 00:14:24 UTC 2020
Closed by commit rHG5b9bb4e9a3bf: share: properly copy cache files when cloning from a share (authored by joerg.sonnenberger).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D9598?vs=24263&id=24314
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D9598/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D9598
AFFECTED FILES
mercurial/hg.py
tests/test-share.t
CHANGE DETAILS
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
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(
To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20201217/02c4bf37/attachment-0002.html>
More information about the Mercurial-patches
mailing list