comparison mercurial/bundle2.py @ 20809:b93bb639451a

bundle2: support for bundling parameter value Parameter can now have a value. We use a `<name>=<value>` form inspired from capabilities. There is still no kind of escaping in the name or value, yet.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 18 Mar 2014 16:05:06 -0700
parents 4c9130c7a29f
children 47293877b54c
comparison
equal deleted inserted replaced
20808:4c9130c7a29f 20809:b93bb639451a
40 :params value: arbitrary number of Bytes 40 :params value: arbitrary number of Bytes
41 41
42 A blob of `params size` containing the serialized version of all stream level 42 A blob of `params size` containing the serialized version of all stream level
43 parameters. 43 parameters.
44 44
45 The blob contains a space separated list of parameters. 45 The blob contains a space separated list of parameters. parameter with value
46 46 are stored in the form `<name>=<value>`.
47 Parameter value are not supported yet.
48 47
49 Special character in param name are not supported yet. 48 Special character in param name are not supported yet.
50 49
51 Stream parameters use a simple textual format for two main reasons: 50 Stream parameters use a simple textual format for two main reasons:
52 51
114 yield '\0\0' 113 yield '\0\0'
115 114
116 def _paramchunk(self): 115 def _paramchunk(self):
117 """return a encoded version of all stream parameters""" 116 """return a encoded version of all stream parameters"""
118 blocks = [] 117 blocks = []
119 for key, value in self._params: 118 for par, value in self._params:
120 # XXX no support for value yet
121 assert value is None
122 # XXX no escaping yet 119 # XXX no escaping yet
123 blocks.append(key) 120 if value is not None:
121 par = '%s=%s' % (par, value)
122 blocks.append(par)
124 return ' '.join(blocks) 123 return ' '.join(blocks)
125 124
126 class unbundle20(object): 125 class unbundle20(object):
127 """interpret a bundle2 stream 126 """interpret a bundle2 stream
128 127