mercurial/bundle2.py
changeset 21139 2b8c82f7f11d
parent 21138 f469879d27ec
child 21144 7a20fe8dc080
equal deleted inserted replaced
21138:f469879d27ec 21139:2b8c82f7f11d
   353             vals = vals.split(',')
   353             vals = vals.split(',')
   354         key = urllib.unquote(key)
   354         key = urllib.unquote(key)
   355         vals = [urllib.unquote(v) for v in vals]
   355         vals = [urllib.unquote(v) for v in vals]
   356         caps[key] = vals
   356         caps[key] = vals
   357     return caps
   357     return caps
       
   358 
       
   359 def encodecaps(caps):
       
   360     """encode a bundle2 caps dictionary into a bytes blob"""
       
   361     chunks = []
       
   362     for ca in sorted(caps):
       
   363         vals = caps[ca]
       
   364         ca = urllib.quote(ca)
       
   365         vals = [urllib.quote(v) for v in vals]
       
   366         if vals:
       
   367             ca = "%s=%s" % (ca, ','.join(vals))
       
   368         chunks.append(ca)
       
   369     return '\n'.join(chunks)
   358 
   370 
   359 class bundle20(object):
   371 class bundle20(object):
   360     """represent an outgoing bundle2 container
   372     """represent an outgoing bundle2 container
   361 
   373 
   362     Use the `addparam` method to add stream level parameter. and `addpart` to
   374     Use the `addparam` method to add stream level parameter. and `addpart` to