Mercurial > hg
comparison mercurial/hg.py @ 17740:e6067bec18da
branchcache: fetch source branchcache during clone (issue3378)
Recomputing branch cache on clone may be expensive,
therefore if possible we fetch it along with the data.
- If the clone is performed by copying, we just copy branchcache file.
- If we localrepo.clone and streaming then we follow the procedure:
1. Fetch branchmap from the remote
2. Fetch the actual data.
3. Find the latest rev within branch heads (tip at the time of
branchmap fetch)
4. Update the cache for the revs in [remotetip+1, tip]
This way we ensure that the branchcache is correct even in case
of races with commits.
author | Tomasz Kleczek <tomasz.kleczek@fb.com> |
---|---|
date | Wed, 03 Oct 2012 13:19:53 -0700 |
parents | 3d1a781b23c0 |
children | 92980a8dfdfe |
comparison
equal
deleted
inserted
replaced
17739:5b08e8b7ab00 | 17740:e6067bec18da |
---|---|
334 % dest) | 334 % dest) |
335 raise | 335 raise |
336 | 336 |
337 destlock = copystore(ui, srcrepo, destpath) | 337 destlock = copystore(ui, srcrepo, destpath) |
338 | 338 |
339 # Recomputing branch cache might be slow on big repos, | |
340 # so just copy it | |
341 dstcachedir = os.path.join(destpath, 'cache') | |
342 srcbranchcache = srcrepo.sjoin('cache/branchheads') | |
343 dstbranchcache = os.path.join(dstcachedir, 'branchheads') | |
344 if os.path.exists(srcbranchcache): | |
345 if not os.path.exists(dstcachedir): | |
346 os.mkdir(dstcachedir) | |
347 util.copyfile(srcbranchcache, dstbranchcache) | |
348 | |
339 # we need to re-init the repo after manually copying the data | 349 # we need to re-init the repo after manually copying the data |
340 # into it | 350 # into it |
341 destpeer = peer(ui, peeropts, dest) | 351 destpeer = peer(ui, peeropts, dest) |
342 srcrepo.hook('outgoing', source='clone', | 352 srcrepo.hook('outgoing', source='clone', |
343 node=node.hex(node.nullid)) | 353 node=node.hex(node.nullid)) |