Mercurial > public > mercurial-scm > hg
diff mercurial/streamclone.py @ 26460:79ef867538ea
branchmap: move branch cache code out of streamclone.py
This is low-level branch map and cache manipulation code. It deserves to
live next to similar code in branchmap.py. Moving it also paves the road
for multiple consumers, such as a bundle2 part handler that receives
branch mappings from a remote.
This is largely a mechanical move, with only variable names and
indentation being changed.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 03 Oct 2015 09:53:56 -0700 |
parents | 3b28ffde133a |
children | 09cc3c2e9ece |
line wrap: on
line diff
--- a/mercurial/streamclone.py Fri Oct 02 23:08:15 2015 -0700 +++ b/mercurial/streamclone.py Sat Oct 03 09:53:56 2015 -0700 @@ -253,31 +253,8 @@ repo._writerequirements() if remotebranchmap: - rbheads = [] - closed = [] - for bheads in remotebranchmap.itervalues(): - rbheads.extend(bheads) - for h in bheads: - r = repo.changelog.rev(h) - b, c = repo.changelog.branchinfo(r) - if c: - closed.append(h) + branchmap.replacecache(repo, remotebranchmap) - if rbheads: - rtiprev = max((int(repo.changelog.rev(node)) - for node in rbheads)) - cache = branchmap.branchcache(remotebranchmap, - repo[rtiprev].node(), - rtiprev, - closednodes=closed) - # Try to stick it as low as possible - # filter above served are unlikely to be fetch from a clone - for candidate in ('base', 'immutable', 'served'): - rview = repo.filtered(candidate) - if cache.validfor(rview): - repo._branchcaches[candidate] = cache - cache.write(rview) - break repo.invalidate() finally: lock.release()