incoming: request a bundle2 when possible (BC)

Incoming was using bundle1 in all cases, as bundle1 is restricted to
changegroup1 and does not support general delta, this can lead to significant
CPU overhead if the server is using general delta storage. We now properly
request and store a bundle2 to disk.

If the server include any output or error in the bundle, they will be stored on
disk and replayed when the bundle is read. As 'hg incoming' is going to read the
bundle right away, we call that 'good' enough and go back to the bigger plan of
having general delta on by default.

This was tracked as 4864
This commit is contained in:
Pierre-Yves David 2015-10-05 00:23:20 -07:00
parent 1bff95dea7
commit 3ff87b1cf4
2 changed files with 14 additions and 2 deletions

View File

@ -455,7 +455,19 @@ def getremotechanges(ui, repo, other, onlyheads=None, bundlename=None,
if bundlename or not localrepo:
# create a bundle (uncompressed if other repo is not local)
if True:
canbundle2 = (ui.configbool('experimental', 'bundle2-exp', True)
and other.capable('getbundle')
and other.capable('bundle2'))
if canbundle2:
kwargs = {}
kwargs['common'] = common
kwargs['heads'] = rheads
kwargs['bundlecaps'] = exchange.caps20to10(repo)
kwargs['cg'] = True
b2 = other.getbundle('incoming', **kwargs)
fname = bundle = changegroup.writechunks(ui, b2._forwardchunks(),
bundlename)
else:
if other.capable('getbundle'):
cg = other.getbundle('incoming', common=common, heads=rheads)
elif onlyheads is None and not other.capable('changegroupsubset'):

View File

@ -350,7 +350,7 @@ Test actual protocol when pulling one new head in addition to common heads
$ cut -d' ' -f6- access.log | grep -v cmd=known # cmd=known uses random sampling
"GET /?cmd=capabilities HTTP/1.1" 200 -
"GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D513314ca8b3ae4dac8eec56966265b00fcf866db
"GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=513314ca8b3ae4dac8eec56966265b00fcf866db&heads=e64a39e7da8b0d54bc63e81169aff001c13b3477
"GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=513314ca8b3ae4dac8eec56966265b00fcf866db&heads=e64a39e7da8b0d54bc63e81169aff001c13b3477
"GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases
$ cat errors.log