changeset 20810:47293877b54c

bundle2: support for unbundling parameter value The unbundler now understand parameter value. introduced in the previous changeset.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 18 Mar 2014 16:12:33 -0700
parents b93bb639451a
children 9785c3f8f598
files mercurial/bundle2.py tests/test-bundle2.t
diffstat 2 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundle2.py	Tue Mar 18 16:05:06 2014 -0700
+++ b/mercurial/bundle2.py	Tue Mar 18 16:12:33 2014 -0700
@@ -152,7 +152,10 @@
         paramssize = self._unpack(_fstreamparamsize)[0]
         if paramssize:
             for p in self._readexact(paramssize).split(' '):
-                params[p] = None
+                p = p.split('=', 1)
+                if len(p) < 2:
+                    p.append(None)
+                params[p[0]] = p[1]
         return params
 
     def __iter__(self):
--- a/tests/test-bundle2.t	Tue Mar 18 16:05:06 2014 -0700
+++ b/tests/test-bundle2.t	Tue Mar 18 16:12:33 2014 -0700
@@ -34,6 +34,9 @@
   >     ui.write('options count: %i\n' % len(unbundler.params))
   >     for key in sorted(unbundler.params):
   >         ui.write('- %s\n' % key)
+  >         value = unbundler.params[key]
+  >         if value is not None:
+  >             ui.write('    %s\n' % value)
   >     parts = list(unbundler)
   >     ui.write('parts count:   %i\n' % len(parts))
   > EOF
@@ -120,3 +123,12 @@
   $ hg bundle2 --param 'caution' --param 'meal=vegan' --param 'elephants'
   HG20\x00\x1ccaution meal=vegan elephants\x00\x00 (no-eol) (esc)
 
+Test unbundling
+
+  $ hg bundle2 --param 'caution' --param 'meal=vegan' --param 'elephants' | hg unbundle2
+  options count: 3
+  - caution
+  - elephants
+  - meal
+      vegan
+  parts count:   0