bundle2: split parameter retrieval and processing
We want to introduce a simple way to forward the content of a bundle2 stream.
For this purpose, we will need to both yield the parameters block and process it
(to apply any behavior change it might indicate).
--- a/mercurial/bundle2.py Mon Oct 05 00:14:47 2015 -0700
+++ b/mercurial/bundle2.py Mon Oct 05 01:10:49 2015 -0700
@@ -657,15 +657,23 @@
raise error.BundleValueError('negative bundle param size: %i'
% paramssize)
if paramssize:
- for p in self._readexact(paramssize).split(' '):
- p = p.split('=', 1)
- p = [urllib.unquote(i) for i in p]
- if len(p) < 2:
- p.append(None)
- self._processparam(*p)
- params[p[0]] = p[1]
+ params = self._readexact(paramssize)
+ params = self._processallparams(params)
return params
+ def _processallparams(self, paramsblock):
+ """"""
+ params = {}
+ for p in paramsblock.split(' '):
+ p = p.split('=', 1)
+ p = [urllib.unquote(i) for i in p]
+ if len(p) < 2:
+ p.append(None)
+ self._processparam(*p)
+ params[p[0]] = p[1]
+ return params
+
+
def _processparam(self, name, value):
"""process a parameter, applying its effect if needed