# HG changeset patch # User Pierre-Yves David # Date 1444032649 25200 # Node ID d40029b4296e986f210ad9bc8bee1ce1523fd189 # Parent 7469067de2ba69273c5327f6fa47eaa7a1857d2e 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). diff -r 7469067de2ba -r d40029b4296e mercurial/bundle2.py --- 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