##// END OF EJS Templates
bundle2: support for unbundling simple parameter...
Pierre-Yves David -
r20805:c5aaeca0 default
parent child Browse files
Show More
@@ -142,9 +142,12 b' class unbundle20(object):'
142 142 @util.propertycache
143 143 def params(self):
144 144 """dictionnary of stream level parameters"""
145 paramsize = self._readexact(2)
146 assert paramsize == '\0\0'
147 return {}
145 params = {}
146 paramssize = self._unpack(_fstreamparamsize)[0]
147 if paramssize:
148 for p in self._readexact(paramssize).split(' '):
149 params[p] = None
150 return params
148 151
149 152 def __iter__(self):
150 153 """yield all parts contained in the stream"""
@@ -30,6 +30,8 b' Create an extension to test bundle2 API'
30 30 > """read a bundle2 container from standard input"""
31 31 > unbundler = bundle2.unbundle20(sys.stdin)
32 32 > ui.write('options count: %i\n' % len(unbundler.params))
33 > for key in sorted(unbundler.params):
34 > ui.write('- %s\n' % key)
33 35 > parts = list(unbundler)
34 36 > ui.write('parts count: %i\n' % len(parts))
35 37 > EOF
@@ -83,12 +85,28 b' advisory parameters, no value'
83 85
84 86 Simplest possible parameters form
85 87
86 Test generation
88 Test generation simple option
87 89
88 90 $ hg bundle2 --param 'caution'
89 91 HG20\x00\x07caution\x00\x00 (no-eol) (esc)
90 92
93 Test unbundling
94
95 $ hg bundle2 --param 'caution' | hg unbundle2
96 options count: 1
97 - caution
98 parts count: 0
99
91 100 Test generation multiple option
92 101
93 102 $ hg bundle2 --param 'caution' --param 'meal'
94 103 HG20\x00\x0ccaution meal\x00\x00 (no-eol) (esc)
104
105 Test unbundling
106
107 $ hg bundle2 --param 'caution' --param 'meal' | hg unbundle2
108 options count: 2
109 - caution
110 - meal
111 parts count: 0
112
General Comments 0
You need to be logged in to leave comments. Login now