# HG changeset patch # User Martin von Zweigbergk # Date 1571506929 25200 # Node ID 0ce6510b45ab39bdd201ba45406b2bdd7268a794 # Parent 33785e94097ad9cb0ac2e4a17cca5bc9973c0e7f obsexchange: delete dead code for old exchange protocol Dead since 79a926b557f1 (compat: drop support for older exchange protocol, 2017-10-25). diff -r 33785e94097a -r 0ce6510b45ab CHANGELOG --- a/CHANGELOG Wed Oct 23 01:14:42 2019 +0200 +++ b/CHANGELOG Sat Oct 19 10:42:09 2019 -0700 @@ -6,6 +6,7 @@ * pick: don't create any successors when there were no changes (issue6093), * metaedit: don't change commit date by default (issue5994), + * exchange: dropped more bundle-1 related dead code. 9.2.1 -- 2019-10-05 ------------------- diff -r 33785e94097a -r 0ce6510b45ab hgext3rd/evolve/obsexchange.py --- a/hgext3rd/evolve/obsexchange.py Wed Oct 23 01:14:42 2019 +0200 +++ b/hgext3rd/evolve/obsexchange.py Sat Oct 19 10:42:09 2019 -0700 @@ -7,17 +7,11 @@ from __future__ import absolute_import -try: - from StringIO import StringIO -except ImportError: - from io import StringIO - from mercurial import ( bundle2, error, exchange, extensions, - lock as lockmod, node, obsolete, pushkey, @@ -35,7 +29,6 @@ eh = exthelper.exthelper() eh.merge(obsdiscovery.eh) obsexcmsg = utility.obsexcmsg -obsexcprg = utility.obsexcprg eh.configitem(b'experimental', b'verbose-obsolescence-exchange', False) @@ -156,82 +149,6 @@ return _obscommon_capabilities(oldcap, repo, proto) wireprotov1server.commands[b'capabilities'] = (newcap, args) -def _pushobsmarkers(repo, data): - tr = lock = None - try: - lock = repo.lock() - tr = repo.transaction(b'pushkey: obsolete markers') - new = repo.obsstore.mergemarkers(tr, data) - if new is not None: - obsexcmsg(repo.ui, b"%i obsolescence markers added\n" % new, True) - tr.close() - finally: - lockmod.release(tr, lock) - repo.hook(b'evolve_pushobsmarkers') - -def srv_pushobsmarkers(repo, proto): - """wireprotocol command""" - fp = StringIO() - proto.redirect() - proto.getfile(fp) - data = fp.getvalue() - fp.close() - _pushobsmarkers(repo, data) - try: - from mercurial import wireprototypes - wireprototypes.pushres # force demandimport - except (ImportError, AttributeError): - from mercurial import wireproto as wireprototypes - return wireprototypes.pushres(0) - -def _getobsmarkersstream(repo, heads=None, common=None): - """Get a binary stream for all markers relevant to `:: - ::` - """ - revset = b'' - args = [] - repo = repo.unfiltered() - if heads is None: - revset = b'all()' - elif heads: - revset += b"(::%ln)" - args.append(heads) - else: - assert False, b'pulling no heads?' - if common: - revset += b' - (::%ln)' - args.append(common) - nodes = [c.node() for c in repo.set(revset, *args)] - markers = repo.obsstore.relevantmarkers(nodes) - obsdata = StringIO() - for chunk in obsolete.encodemarkers(markers, True): - obsdata.write(chunk) - obsdata.seek(0) - return obsdata - -def srv_pullobsmarkers(repo, proto, others): - """serves a binary stream of markers. - - Serves relevant to changeset between heads and common. The stream is prefix - by a -string- representation of an integer. This integer is the size of the - stream.""" - try: - from mercurial import wireprototypes, wireprotov1server - wireprototypes.pushres # force demandimport - except (ImportError, AttributeError): - from mercurial import wireproto as wireprototypes - wireprotov1server = wireprototypes - opts = wireprotov1server.options(b'', [b'heads', b'common'], others) - for k, v in opts.items(): - if k in (b'heads', b'common'): - opts[k] = wireprototypes.decodelist(v) - obsdata = _getobsmarkersstream(repo, **opts) - finaldata = StringIO() - obsdata = obsdata.getvalue() - finaldata.write(b'%20i' % len(obsdata)) - finaldata.write(obsdata) - finaldata.seek(0) - return wireprototypes.streamres(reader=finaldata, v1compressible=True) - abortmsg = b"won't exchange obsmarkers through pushkey" hint = b"upgrade your client or server to use the bundle2 protocol" diff -r 33785e94097a -r 0ce6510b45ab hgext3rd/evolve/utility.py --- a/hgext3rd/evolve/utility.py Wed Oct 23 01:14:42 2019 +0200 +++ b/hgext3rd/evolve/utility.py Sat Oct 19 10:42:09 2019 -0700 @@ -13,10 +13,6 @@ from mercurial.node import nullrev -from . import ( - compat, -) - shorttemplate = b"[{label('evolve.rev', rev)}] {desc|firstline}\n" stacktemplate = b"""[{label('evolve.rev', if(topicidx, "s{topicidx}", rev))}] {desc|firstline}\n""" @@ -27,12 +23,6 @@ if important or verbose: ui.status(message) -def obsexcprg(ui, *args, **kwargs): - topic = b'obsmarkers exchange' - if ui.configbool(b'experimental', b'verbose-obsolescence-exchange'): - topic = b'OBSEXC' - compat.progress(ui, topic, *args, **kwargs) - def filterparents(parents): """filter nullrev parents