##// END OF EJS Templates
bundle2: don't try to recover from a GeneratorExit (issue4785)...
Augie Fackler -
r26144:4bc3707f default
parent child Browse files
Show More
@@ -847,6 +847,12 b' class bundlepart(object):'
847 outdebug(ui, 'payload chunk size: %i' % len(chunk))
847 outdebug(ui, 'payload chunk size: %i' % len(chunk))
848 yield _pack(_fpayloadsize, len(chunk))
848 yield _pack(_fpayloadsize, len(chunk))
849 yield chunk
849 yield chunk
850 except GeneratorExit:
851 # GeneratorExit means that nobody is listening for our
852 # results anyway, so just bail quickly rather than trying
853 # to produce an error part.
854 ui.debug('bundle2-generatorexit\n')
855 raise
850 except BaseException as exc:
856 except BaseException as exc:
851 # backup exception data for later
857 # backup exception data for later
852 ui.debug('bundle2-input-stream-interrupt: encoding exception %s'
858 ui.debug('bundle2-input-stream-interrupt: encoding exception %s'
@@ -78,6 +78,7 b' Create an extension to test bundle2 API'
78 > ('', 'reply', False, 'produce a reply bundle'),
78 > ('', 'reply', False, 'produce a reply bundle'),
79 > ('', 'pushrace', False, 'includes a check:head part with unknown nodes'),
79 > ('', 'pushrace', False, 'includes a check:head part with unknown nodes'),
80 > ('', 'genraise', False, 'includes a part that raise an exception during generation'),
80 > ('', 'genraise', False, 'includes a part that raise an exception during generation'),
81 > ('', 'timeout', False, 'emulate a timeout during bundle generation'),
81 > ('r', 'rev', [], 'includes those changeset in the bundle'),],
82 > ('r', 'rev', [], 'includes those changeset in the bundle'),],
82 > '[OUTPUTFILE]')
83 > '[OUTPUTFILE]')
83 > def cmdbundle2(ui, repo, path=None, **opts):
84 > def cmdbundle2(ui, repo, path=None, **opts):
@@ -143,6 +144,18 b' Create an extension to test bundle2 API'
143 > else:
144 > else:
144 > file = open(path, 'wb')
145 > file = open(path, 'wb')
145 >
146 >
147 > if opts['timeout']:
148 > bundler.newpart('test:song', data=ELEPHANTSSONG, mandatory=False)
149 > for idx, junk in enumerate(bundler.getchunks()):
150 > ui.write('%d chunk\n' % idx)
151 > if idx > 4:
152 > # This throws a GeneratorExit inside the generator, which
153 > # can cause problems if the exception-recovery code is
154 > # too zealous. It's important for this test that the break
155 > # occur while we're in the middle of a part.
156 > break
157 > ui.write('fake timeout complete.\n')
158 > return
146 > try:
159 > try:
147 > for chunk in bundler.getchunks():
160 > for chunk in bundler.getchunks():
148 > file.write(chunk)
161 > file.write(chunk)
@@ -239,6 +252,26 b' Test bundling'
239 $ hg bundle2
252 $ hg bundle2
240 HG20\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
253 HG20\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
241
254
255 Test timeouts during bundling
256 $ hg bundle2 --timeout --debug --config devel.bundle2.debug=yes
257 bundle2-output-bundle: "HG20", 1 parts total
258 bundle2-output: start emission of HG20 stream
259 0 chunk
260 bundle2-output: bundle parameter:
261 1 chunk
262 bundle2-output: start of parts
263 bundle2-output: bundle part: "test:song"
264 bundle2-output-part: "test:song" (advisory) 178 bytes payload
265 bundle2-output: part 0: "test:song"
266 bundle2-output: header chunk size: 16
267 2 chunk
268 3 chunk
269 bundle2-output: payload chunk size: 178
270 4 chunk
271 5 chunk
272 bundle2-generatorexit
273 fake timeout complete.
274
242 Test unbundling
275 Test unbundling
243
276
244 $ hg bundle2 | hg statbundle2
277 $ hg bundle2 | hg statbundle2
General Comments 0
You need to be logged in to leave comments. Login now