# HG changeset patch # User Gregory Szorc # Date 1523494300 25200 # Node ID d959277ff1b55955303a389b8acb5d45fe474502 # Parent add1298111766957f34939bbd398b0f08e193ff0 bundlerepo: rename "other" to "peer" Differential Revision: https://phab.mercurial-scm.org/D3293 diff -r add129811176 -r d959277ff1b5 mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py Fri Apr 13 11:19:39 2018 -0700 +++ b/mercurial/bundlerepo.py Wed Apr 11 17:51:40 2018 -0700 @@ -492,9 +492,9 @@ def release(self): raise NotImplementedError -def getremotechanges(ui, repo, other, onlyheads=None, bundlename=None, +def getremotechanges(ui, repo, peer, onlyheads=None, bundlename=None, force=False): - '''obtains a bundle of changes incoming from other + '''obtains a bundle of changes incoming from peer "onlyheads" restricts the returned changes to those reachable from the specified heads. @@ -507,13 +507,13 @@ "local" is a local repo from which to obtain the actual incoming changesets; it is a bundlerepo for the obtained bundle when the - original "other" is remote. + original "peer" is remote. "csets" lists the incoming changeset node ids. "cleanupfn" must be called without arguments when you're done processing - the changes; it closes both the original "other" and the one returned + the changes; it closes both the original "peer" and the one returned here. ''' - tmp = discovery.findcommonincoming(repo, other, heads=onlyheads, + tmp = discovery.findcommonincoming(repo, peer, heads=onlyheads, force=force) common, incoming, rheads = tmp if not incoming: @@ -522,39 +522,39 @@ os.unlink(bundlename) except OSError: pass - return repo, [], other.close + return repo, [], peer.close commonset = set(common) rheads = [x for x in rheads if x not in commonset] bundle = None bundlerepo = None - localrepo = other.local() + localrepo = peer.local() if bundlename or not localrepo: - # create a bundle (uncompressed if other repo is not local) + # create a bundle (uncompressed if peer repo is not local) # developer config: devel.legacy.exchange legexc = ui.configlist('devel', 'legacy.exchange') forcebundle1 = 'bundle2' not in legexc and 'bundle1' in legexc canbundle2 = (not forcebundle1 - and other.capable('getbundle') - and other.capable('bundle2')) + and peer.capable('getbundle') + and peer.capable('bundle2')) if canbundle2: kwargs = {} kwargs[r'common'] = common kwargs[r'heads'] = rheads kwargs[r'bundlecaps'] = exchange.caps20to10(repo, role='client') kwargs[r'cg'] = True - b2 = other.getbundle('incoming', **kwargs) + b2 = peer.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'): + if peer.capable('getbundle'): + cg = peer.getbundle('incoming', common=common, heads=rheads) + elif onlyheads is None and not peer.capable('changegroupsubset'): # compat with older servers when pulling all remote heads - with other.commandexecutor() as e: + with peer.commandexecutor() as e: cg = e.callcommand('changegroup', { 'nodes': incoming, 'source': 'incoming', @@ -562,7 +562,7 @@ rheads = None else: - with other.commandexecutor() as e: + with peer.commandexecutor() as e: cg = e.callcommand('changegroupsubset', { 'bases': incoming, 'heads': rheads, @@ -582,7 +582,7 @@ # use the created uncompressed bundlerepo localrepo = bundlerepo = bundlerepository(repo.baseui, repo.root, fname) - # this repo contains local and other now, so filter out local again + # this repo contains local and peer now, so filter out local again common = repo.heads() if localrepo: # Part of common may be remotely filtered @@ -594,9 +594,9 @@ if bundlerepo: reponodes = [ctx.node() for ctx in bundlerepo[bundlerepo.firstnewrev:]] - remotephases = other.listkeys('phases') + remotephases = peer.listkeys('phases') - pullop = exchange.pulloperation(bundlerepo, other, heads=reponodes) + pullop = exchange.pulloperation(bundlerepo, peer, heads=reponodes) pullop.trmanager = bundletransactionmanager() exchange._pullapplyphases(pullop, remotephases) @@ -605,6 +605,6 @@ bundlerepo.close() if bundle: os.unlink(bundle) - other.close() + peer.close() return (localrepo, csets, cleanup)