diff mercurial/wireproto.py @ 37613:96d735601ca1

wireproto: move gboptsmap to wireprototypes and rename (API) This is also shared between client and server and will need to exist in a shared module when that code is split into different modules. Differential Revision: https://phab.mercurial-scm.org/D3258
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 11 Apr 2018 10:51:38 -0700
parents 5e71dea79aae
children a81d02ea65db
line wrap: on
line diff
--- a/mercurial/wireproto.py	Wed Apr 11 10:50:58 2018 -0700
+++ b/mercurial/wireproto.py	Wed Apr 11 10:51:38 2018 -0700
@@ -145,29 +145,6 @@
             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 @@
         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 @@
 @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':