mercurial/bundle2.py
changeset 21136 b6fd496e5c72
parent 21135 98fbf3adfd83
child 21137 341a083603a5
--- a/mercurial/bundle2.py	Thu Apr 17 11:32:30 2014 -0400
+++ b/mercurial/bundle2.py	Thu Apr 17 11:44:49 2014 -0400
@@ -344,7 +344,7 @@
         self.ui = ui
         self._params = []
         self._parts = []
-        self.capabilities = set(capabilities)
+        self.capabilities = dict(capabilities)
 
     def addparam(self, name, value=None):
         """add a stream level parameter"""
@@ -697,8 +697,22 @@
 def handlereplycaps(op, inpart):
     """Notify that a reply bundle should be created
 
-    the part payload is a list of capabilities (one per line)"""
-    caps = [c for c in inpart.read().splitlines() if c]
+    The part payload is a list of capabilities (one per line)
+    Capabilities may have values using a line of form::
+
+        capability=value1,value2,value3
+
+    The value are alway a list."""
+    caps = {}
+    for line in inpart.read().splitlines():
+        if not line:
+            continue
+        if '=' not in line:
+            key, vals = line, ()
+        else:
+            key, vals = line.split('=', 1)
+            vals = vals.split(',')
+        caps[key] = vals
     if op.reply is None:
         op.reply = bundle20(op.ui, caps)