Mercurial > hg
comparison mercurial/exchange.py @ 36966:c0e90df1ab1e
revbranchcache: add the necessary bit to send 'rbc' data over bundle2
Getbundle is now capable of sending rev-branch-cache information for the
changesets it bundle. The data sent are mostly nodes so it is quite compact.
The goal of the rev-branch-cache is to speed up branch map computation,
especially when the branchmap gets invalidated so we send data for all
exchanged changesets. In addition, computing the relevant heads to send in
case of partial pulling would be challenging.
The feature is still inactive since the capability is not advertised yet.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Thu, 18 Jan 2018 14:58:02 +0100 |
parents | 8fd9b56e8d7c |
children | f0b6fbea00cf |
comparison
equal
deleted
inserted
replaced
36965:b89a7ef29013 | 36966:c0e90df1ab1e |
---|---|
1937 return | 1937 return |
1938 | 1938 |
1939 outgoing = _computeoutgoing(repo, heads, common) | 1939 outgoing = _computeoutgoing(repo, heads, common) |
1940 bundle2.addparttagsfnodescache(repo, bundler, outgoing) | 1940 bundle2.addparttagsfnodescache(repo, bundler, outgoing) |
1941 | 1941 |
1942 @getbundle2partsgenerator('cache:rev-branch-cache') | |
1943 def _getbundlerevbranchcache(bundler, repo, source, bundlecaps=None, | |
1944 b2caps=None, heads=None, common=None, | |
1945 **kwargs): | |
1946 """Transfer the rev-branch-cache mapping | |
1947 | |
1948 The payload is a series of data related to each branch | |
1949 | |
1950 1) branch name length | |
1951 2) number of open heads | |
1952 3) number of closed heads | |
1953 4) open heads nodes | |
1954 5) closed heads nodes | |
1955 """ | |
1956 # Don't send unless: | |
1957 # - changeset are being exchanged, | |
1958 # - the client supports it. | |
1959 if not (kwargs.get(r'cg', True)) or 'rev-branch-cache' not in b2caps: | |
1960 return | |
1961 outgoing = _computeoutgoing(repo, heads, common) | |
1962 bundle2.addpartrevbranchcache(repo, bundler, outgoing) | |
1963 | |
1942 def check_heads(repo, their_heads, context): | 1964 def check_heads(repo, their_heads, context): |
1943 """check if the heads of a repo have been modified | 1965 """check if the heads of a repo have been modified |
1944 | 1966 |
1945 Used by peer for unbundling. | 1967 Used by peer for unbundling. |
1946 """ | 1968 """ |