Mercurial > public > mercurial-scm > hg
comparison mercurial/bundlerepo.py @ 26544:1e8e0b01faba
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
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 05 Oct 2015 00:23:20 -0700 |
parents | a018cbabdb51 |
children | 56b2bcea2529 |
comparison
equal
deleted
inserted
replaced
26543:a018cbabdb51 | 26544:1e8e0b01faba |
---|---|
453 bundlerepo = None | 453 bundlerepo = None |
454 localrepo = other.local() | 454 localrepo = other.local() |
455 if bundlename or not localrepo: | 455 if bundlename or not localrepo: |
456 # create a bundle (uncompressed if other repo is not local) | 456 # create a bundle (uncompressed if other repo is not local) |
457 | 457 |
458 if True: | 458 canbundle2 = (ui.configbool('experimental', 'bundle2-exp', True) |
459 and other.capable('getbundle') | |
460 and other.capable('bundle2')) | |
461 if canbundle2: | |
462 kwargs = {} | |
463 kwargs['common'] = common | |
464 kwargs['heads'] = rheads | |
465 kwargs['bundlecaps'] = exchange.caps20to10(repo) | |
466 kwargs['cg'] = True | |
467 b2 = other.getbundle('incoming', **kwargs) | |
468 fname = bundle = changegroup.writechunks(ui, b2._forwardchunks(), | |
469 bundlename) | |
470 else: | |
459 if other.capable('getbundle'): | 471 if other.capable('getbundle'): |
460 cg = other.getbundle('incoming', common=common, heads=rheads) | 472 cg = other.getbundle('incoming', common=common, heads=rheads) |
461 elif onlyheads is None and not other.capable('changegroupsubset'): | 473 elif onlyheads is None and not other.capable('changegroupsubset'): |
462 # compat with older servers when pulling all remote heads | 474 # compat with older servers when pulling all remote heads |
463 cg = other.changegroup(incoming, "incoming") | 475 cg = other.changegroup(incoming, "incoming") |