Mercurial > public > mercurial-scm > hg-stable
diff mercurial/bundle2.py @ 46444:3e91d9978bec
branchmap: update rev-branch-cache incrementally
Historically, the revision to branch mapping cache was updated on demand
and shared via bundle2 to avoid the cost of rebuilding on first use.
Use the new `register_changeset` callback and update rbc directly on
every change. Make the transfer of the bundle part redundant, but keep
it for the moment to avoid the test churn.
Over all, "hg unbundle" for large bundles is less than 1.8% slower for
different larger repositories and that seems to a reasonable trade off.
Differential Revision: https://phab.mercurial-scm.org/D9781
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Fri, 15 Jan 2021 01:58:59 +0100 |
parents | c511fef30290 |
children | 29e3e46b0a22 |
line wrap: on
line diff
--- a/mercurial/bundle2.py Tue Jan 19 00:20:53 2021 +0100 +++ b/mercurial/bundle2.py Fri Jan 15 01:58:59 2021 +0100 @@ -2478,35 +2478,10 @@ @parthandler(b'cache:rev-branch-cache') def handlerbc(op, inpart): - """receive a rev-branch-cache payload and update the local cache - - The payload is a series of data related to each branch - - 1) branch name length - 2) number of open heads - 3) number of closed heads - 4) open heads nodes - 5) closed heads nodes - """ - total = 0 - rawheader = inpart.read(rbcstruct.size) - cache = op.repo.revbranchcache() - cl = op.repo.unfiltered().changelog - while rawheader: - header = rbcstruct.unpack(rawheader) - total += header[1] + header[2] - utf8branch = inpart.read(header[0]) - branch = encoding.tolocal(utf8branch) - for x in pycompat.xrange(header[1]): - node = inpart.read(20) - rev = cl.rev(node) - cache.setdata(branch, rev, node, False) - for x in pycompat.xrange(header[2]): - node = inpart.read(20) - rev = cl.rev(node) - cache.setdata(branch, rev, node, True) - rawheader = inpart.read(rbcstruct.size) - cache.write() + """Legacy part, ignored for compatibility with bundles from or + for Mercurial before 5.7. Newer Mercurial computes the cache + efficiently enough during unbundling that the additional transfer + is unnecessary.""" @parthandler(b'pushvars')