Details
Details
- Reviewers
durin42 - Group Reviewers
hg-reviewers - Commits
- rHG1aa4d646d0de: bundlerepo: use command executor for wire protocol commands
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
durin42 |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/bundlerepo.py (33 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg |
# developer config: devel.legacy.exchange | # developer config: devel.legacy.exchange | ||||
legexc = ui.configlist('devel', 'legacy.exchange') | legexc = ui.configlist('devel', 'legacy.exchange') | ||||
forcebundle1 = 'bundle2' not in legexc and 'bundle1' in legexc | forcebundle1 = 'bundle2' not in legexc and 'bundle1' in legexc | ||||
canbundle2 = (not forcebundle1 | canbundle2 = (not forcebundle1 | ||||
and peer.capable('getbundle') | and peer.capable('getbundle') | ||||
and peer.capable('bundle2')) | and peer.capable('bundle2')) | ||||
if canbundle2: | if canbundle2: | ||||
kwargs = {} | with peer.commandexecutor() as e: | ||||
kwargs[r'common'] = common | b2 = e.callcommand('getbundle', { | ||||
kwargs[r'heads'] = rheads | 'source': 'incoming', | ||||
kwargs[r'bundlecaps'] = exchange.caps20to10(repo, role='client') | 'common': common, | ||||
kwargs[r'cg'] = True | 'heads': rheads, | ||||
b2 = peer.getbundle('incoming', **kwargs) | 'bundlecaps': exchange.caps20to10(repo, role='client'), | ||||
fname = bundle = changegroup.writechunks(ui, b2._forwardchunks(), | 'cg': True, | ||||
}).result() | |||||
fname = bundle = changegroup.writechunks(ui, | |||||
b2._forwardchunks(), | |||||
bundlename) | bundlename) | ||||
else: | else: | ||||
if peer.capable('getbundle'): | if peer.capable('getbundle'): | ||||
cg = peer.getbundle('incoming', common=common, heads=rheads) | with peer.commandexecutor() as e: | ||||
cg = e.callcommand('getbundle', { | |||||
'source': 'incoming', | |||||
'common': common, | |||||
'heads': rheads, | |||||
}).result() | |||||
elif onlyheads is None and not peer.capable('changegroupsubset'): | elif onlyheads is None and not peer.capable('changegroupsubset'): | ||||
# compat with older servers when pulling all remote heads | # compat with older servers when pulling all remote heads | ||||
with peer.commandexecutor() as e: | with peer.commandexecutor() as e: | ||||
cg = e.callcommand('changegroup', { | cg = e.callcommand('changegroup', { | ||||
'nodes': incoming, | 'nodes': incoming, | ||||
'source': 'incoming', | 'source': 'incoming', | ||||
}).result() | }).result() | ||||
# So use an unfiltered version | # So use an unfiltered version | ||||
# The discovery process probably need cleanup to avoid that | # The discovery process probably need cleanup to avoid that | ||||
localrepo = localrepo.unfiltered() | localrepo = localrepo.unfiltered() | ||||
csets = localrepo.changelog.findmissing(common, rheads) | csets = localrepo.changelog.findmissing(common, rheads) | ||||
if bundlerepo: | if bundlerepo: | ||||
reponodes = [ctx.node() for ctx in bundlerepo[bundlerepo.firstnewrev:]] | reponodes = [ctx.node() for ctx in bundlerepo[bundlerepo.firstnewrev:]] | ||||
remotephases = peer.listkeys('phases') | |||||
with peer.commandexecutor() as e: | |||||
remotephases = e.callcommand('listkeys', { | |||||
'namespace': 'phases', | |||||
}).result() | |||||
pullop = exchange.pulloperation(bundlerepo, peer, heads=reponodes) | pullop = exchange.pulloperation(bundlerepo, peer, heads=reponodes) | ||||
pullop.trmanager = bundletransactionmanager() | pullop.trmanager = bundletransactionmanager() | ||||
exchange._pullapplyphases(pullop, remotephases) | exchange._pullapplyphases(pullop, remotephases) | ||||
def cleanup(): | def cleanup(): | ||||
if bundlerepo: | if bundlerepo: | ||||
bundlerepo.close() | bundlerepo.close() | ||||
if bundle: | if bundle: | ||||
os.unlink(bundle) | os.unlink(bundle) | ||||
peer.close() | peer.close() | ||||
return (localrepo, csets, cleanup) | return (localrepo, csets, cleanup) |