##// END OF EJS Templates
bundle2: add ability to write to a file to the test...
Pierre-Yves David -
r20841:cff562fe default
parent child Browse files
Show More
@@ -17,8 +17,8 b' Create an extension to test bundle2 API'
17 >
17 >
18 > @command('bundle2',
18 > @command('bundle2',
19 > [('', 'param', [], 'stream level parameter'),],
19 > [('', 'param', [], 'stream level parameter'),],
20 > '')
20 > '[OUTPUTFILE]')
21 > def cmdbundle2(ui, repo, **opts):
21 > def cmdbundle2(ui, repo, path=None, **opts):
22 > """write a bundle2 container on standard ouput"""
22 > """write a bundle2 container on standard ouput"""
23 > bundler = bundle2.bundle20()
23 > bundler = bundle2.bundle20()
24 > for p in opts['param']:
24 > for p in opts['param']:
@@ -28,8 +28,13 b' Create an extension to test bundle2 API'
28 > except ValueError, exc:
28 > except ValueError, exc:
29 > raise util.Abort('%s' % exc)
29 > raise util.Abort('%s' % exc)
30 >
30 >
31 > if path is None:
32 > file = sys.stdout
33 > else:
34 > file = open(path, 'w')
35 >
31 > for chunk in bundler.getchunks():
36 > for chunk in bundler.getchunks():
32 > ui.write(chunk)
37 > file.write(chunk)
33 >
38 >
34 > @command('unbundle2', [], '')
39 > @command('unbundle2', [], '')
35 > def cmdunbundle2(ui, repo):
40 > def cmdunbundle2(ui, repo):
@@ -154,6 +159,17 b' Test unbundling'
154 - simple
159 - simple
155 parts count: 0
160 parts count: 0
156
161
162 Test debug output
163 ---------------------------------------------------
164 (no debug output yet)
165
166 $ hg bundle2 --debug --param 'e|! 7/=babar%#==tutu' --param simple ../out.hg2
167
168 file content is ok
169
170 $ cat ../out.hg2
171 HG20\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00 (no-eol) (esc)
172
157 Test buggy input
173 Test buggy input
158 ---------------------------------------------------
174 ---------------------------------------------------
159
175
General Comments 0
You need to be logged in to leave comments. Login now