Patchwork [5,of,7] bundle2: urlunquote stream parameter name and value during unbundling

login
register
mail settings
Submitter Pierre-Yves David
Date March 21, 2014, 9:57 p.m.
Message ID <7d3033759ef21b18f4c8.1395439050@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4028/
State Accepted
Commit e2f908773754d02f20b5a21a674bb9bf343cbdb6
Headers show

Comments

Pierre-Yves David - March 21, 2014, 9:57 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1395189788 25200
#      Tue Mar 18 17:43:08 2014 -0700
# Node ID 7d3033759ef21b18f4c85a2bca2de2c54c77e42d
# Parent  61c50b7ad004815e93d6d3c75446fe5b7f520786
bundle2: urlunquote stream parameter name and value during unbundling

Align to new escaping used during bundling.

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -151,10 +151,11 @@  class unbundle20(object):
         params = {}
         paramssize = self._unpack(_fstreamparamsize)[0]
         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)
                 params[p[0]] = p[1]
         return params
 
diff --git a/tests/test-bundle2.t b/tests/test-bundle2.t
--- a/tests/test-bundle2.t
+++ b/tests/test-bundle2.t
@@ -138,5 +138,14 @@  parameter with special char in value
 
 Test generation
 
   $ hg bundle2 --param 'e|! 7/=babar%#==tutu' --param simple
   HG20\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00 (no-eol) (esc)
+
+Test unbundling
+
+  $ hg bundle2 --param 'e|! 7/=babar%#==tutu' --param simple | hg unbundle2
+  options count: 2
+  - e|! 7/
+      babar%#==tutu
+  - simple
+  parts count:   0