diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -27,7 +27,7 @@ from mercurial import ( narrowspec, repair, util, - wireproto, + wireprototypes, ) from mercurial.utils import ( stringutil, @@ -461,13 +461,15 @@ def setup(): """Enable narrow repo support in bundle2-related extension points.""" extensions.wrapfunction(bundle2, 'getrepocaps', getrepocaps_narrow) - wireproto.gboptsmap['narrow'] = 'boolean' - wireproto.gboptsmap['depth'] = 'plain' - wireproto.gboptsmap['oldincludepats'] = 'csv' - wireproto.gboptsmap['oldexcludepats'] = 'csv' - wireproto.gboptsmap['includepats'] = 'csv' - wireproto.gboptsmap['excludepats'] = 'csv' - wireproto.gboptsmap['known'] = 'csv' + getbundleargs = wireprototypes.GETBUNDLE_ARGUMENTS + + getbundleargs['narrow'] = 'boolean' + getbundleargs['depth'] = 'plain' + getbundleargs['oldincludepats'] = 'csv' + getbundleargs['oldexcludepats'] = 'csv' + getbundleargs['includepats'] = 'csv' + getbundleargs['excludepats'] = 'csv' + getbundleargs['known'] = 'csv' # Extend changegroup serving to handle requests from narrow clients. origcgfn = exchange.getbundle2partsmapping['changegroup'] diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -145,29 +145,6 @@ def clientcompressionsupport(proto): return cap[5:].split(',') return ['zlib', 'none'] -# mapping of options accepted by getbundle and their types -# -# Meant to be extended by extensions. It is extensions responsibility to ensure -# such options are properly processed in exchange.getbundle. -# -# supported types are: -# -# :nodes: list of binary nodes -# :csv: list of comma-separated values -# :scsv: list of comma-separated values return as set -# :plain: string with no transformation needed. -gboptsmap = {'heads': 'nodes', - 'bookmarks': 'boolean', - 'common': 'nodes', - 'obsmarkers': 'boolean', - 'phases': 'boolean', - 'bundlecaps': 'scsv', - 'listkeys': 'csv', - 'cg': 'boolean', - 'cbattempted': 'boolean', - 'stream': 'boolean', -} - # client side class wirepeer(repository.legacypeer): @@ -275,7 +252,7 @@ class wirepeer(repository.legacypeer): for key, value in kwargs.iteritems(): if value is None: continue - keytype = gboptsmap.get(key) + keytype = wireprototypes.GETBUNDLE_ARGUMENTS.get(key) if keytype is None: raise error.ProgrammingError( 'Unexpectedly None keytype for key %s' % key) @@ -1004,9 +981,10 @@ def find_pullbundle(repo, proto, opts, c @wireprotocommand('getbundle', '*', permission='pull', transportpolicy=POLICY_V1_ONLY) def getbundle(repo, proto, others): - opts = options('getbundle', gboptsmap.keys(), others) + opts = options('getbundle', wireprototypes.GETBUNDLE_ARGUMENTS.keys(), + others) for k, v in opts.iteritems(): - keytype = gboptsmap[k] + keytype = wireprototypes.GETBUNDLE_ARGUMENTS[k] if keytype == 'nodes': opts[k] = wireprototypes.decodelist(v) elif keytype == 'csv': diff --git a/mercurial/wireprototypes.py b/mercurial/wireprototypes.py --- a/mercurial/wireprototypes.py +++ b/mercurial/wireprototypes.py @@ -134,6 +134,30 @@ def unescapebatcharg(escaped): .replace(':o', ',') .replace(':c', ':')) +# mapping of options accepted by getbundle and their types +# +# Meant to be extended by extensions. It is extensions responsibility to ensure +# such options are properly processed in exchange.getbundle. +# +# supported types are: +# +# :nodes: list of binary nodes +# :csv: list of comma-separated values +# :scsv: list of comma-separated values return as set +# :plain: string with no transformation needed. +GETBUNDLE_ARGUMENTS = { + 'heads': 'nodes', + 'bookmarks': 'boolean', + 'common': 'nodes', + 'obsmarkers': 'boolean', + 'phases': 'boolean', + 'bundlecaps': 'scsv', + 'listkeys': 'csv', + 'cg': 'boolean', + 'cbattempted': 'boolean', + 'stream': 'boolean', +} + class baseprotocolhandler(zi.Interface): """Abstract base class for wire protocol handlers.