comparison tests/test-bundle2.t @ 20844:2631204d7305

bundle2: implement the mandatory/advisory logic for parameter Parameter starting with an upper case are mandatory, the one starting with a lower case are advisory and may be ignored.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 19 Mar 2014 17:53:45 -0700
parents 0641b41b0b49
children 8a6a86c9a5b5
comparison
equal deleted inserted replaced
20843:0641b41b0b49 20844:2631204d7305
38 > 38 >
39 > @command('unbundle2', [], '') 39 > @command('unbundle2', [], '')
40 > def cmdunbundle2(ui, repo): 40 > def cmdunbundle2(ui, repo):
41 > """read a bundle2 container from standard input""" 41 > """read a bundle2 container from standard input"""
42 > unbundler = bundle2.unbundle20(ui, sys.stdin) 42 > unbundler = bundle2.unbundle20(ui, sys.stdin)
43 > ui.write('options count: %i\n' % len(unbundler.params)) 43 > try:
44 > for key in sorted(unbundler.params): 44 > params = unbundler.params
45 > except KeyError, exc:
46 > raise util.Abort('unknown parameters: %s' % exc)
47 > ui.write('options count: %i\n' % len(params))
48 > for key in sorted(params):
45 > ui.write('- %s\n' % key) 49 > ui.write('- %s\n' % key)
46 > value = unbundler.params[key] 50 > value = params[key]
47 > if value is not None: 51 > if value is not None:
48 > ui.write(' %s\n' % value) 52 > ui.write(' %s\n' % value)
49 > parts = list(unbundler) 53 > parts = list(unbundler)
50 > ui.write('parts count: %i\n' % len(parts)) 54 > ui.write('parts count: %i\n' % len(parts))
51 > EOF 55 > EOF
157 - e|! 7/ 161 - e|! 7/
158 babar%#==tutu 162 babar%#==tutu
159 - simple 163 - simple
160 parts count: 0 164 parts count: 0
161 165
166 Test unknown mandatory option
167 ---------------------------------------------------
168
169 $ hg bundle2 --param 'Gravity' | hg unbundle2
170 abort: unknown parameters: 'Gravity'
171 [255]
172
162 Test debug output 173 Test debug output
163 --------------------------------------------------- 174 ---------------------------------------------------
164 175
165 bundling debug 176 bundling debug
166 177
177 unbundling debug 188 unbundling debug
178 189
179 $ hg unbundle2 --debug < ../out.hg2 190 $ hg unbundle2 --debug < ../out.hg2
180 start processing of HG20 stream 191 start processing of HG20 stream
181 reading bundle2 stream parameters 192 reading bundle2 stream parameters
193 ignoring unknown parameter 'e|! 7/'
194 ignoring unknown parameter 'simple'
182 options count: 2 195 options count: 2
183 - e|! 7/ 196 - e|! 7/
184 babar%#==tutu 197 babar%#==tutu
185 - simple 198 - simple
186 start extraction of bundle2 parts 199 start extraction of bundle2 parts