This revision was automatically updated to reflect the committed changes.
Closed by commit rHG96d735601ca1: wireproto: move gboptsmap to wireprototypes 
and rename (API) (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3258?vs=8024&id=8099

REVISION DETAIL
  https://phab.mercurial-scm.org/D3258

AFFECTED FILES
  hgext/narrow/narrowbundle2.py
  mercurial/wireproto.py
  mercurial/wireprototypes.py

CHANGE DETAILS

diff --git a/mercurial/wireprototypes.py b/mercurial/wireprototypes.py
--- a/mercurial/wireprototypes.py
+++ b/mercurial/wireprototypes.py
@@ -134,6 +134,30 @@
             .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.
 
diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -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':
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 @@
     narrowspec,
     repair,
     util,
-    wireproto,
+    wireprototypes,
 )
 from mercurial.utils import (
     stringutil,
@@ -461,13 +461,15 @@
     """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']



To: indygreg, durin42, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to