comparison mercurial/bundle2.py @ 24851:df0ce98c882f stable

bundle2: also save output when error happens during part processing Until this changeset, we were only able to save output if an error happened during the 'transaction.close()' phase. If the 'processbundle' call raised an exception, the 'bundleoperation' object was never returned, so the reply bundle was never accessible and no output could be salvaged. We introduce a quick (but not very elegant) fix to gain access to any reply created during the processing. This conclude this output related series. We should hopefully be able client-side to see the whole server output, in a proper order. The code is now complex enough that a refactoring of it would make sense on default.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 23 Apr 2015 16:36:18 +0100
parents aff2aca3420e
children e530cde6d115
comparison
equal deleted inserted replaced
24850:6b81309d15a7 24851:df0ce98c882f
283 283
284 Raise an exception to highlight the fact that no transaction was expected 284 Raise an exception to highlight the fact that no transaction was expected
285 to be created""" 285 to be created"""
286 raise TransactionUnavailable() 286 raise TransactionUnavailable()
287 287
288 def processbundle(repo, unbundler, transactiongetter=None): 288 def processbundle(repo, unbundler, transactiongetter=None, op=None):
289 """This function process a bundle, apply effect to/from a repo 289 """This function process a bundle, apply effect to/from a repo
290 290
291 It iterates over each part then searches for and uses the proper handling 291 It iterates over each part then searches for and uses the proper handling
292 code to process the part. Parts are processed in order. 292 code to process the part. Parts are processed in order.
293 293
294 This is very early version of this function that will be strongly reworked 294 This is very early version of this function that will be strongly reworked
295 before final usage. 295 before final usage.
296 296
297 Unknown Mandatory part will abort the process. 297 Unknown Mandatory part will abort the process.
298
299 It is temporarily possible to provide a prebuilt bundleoperation to the
300 function. This is used to ensure output is properly propagated in case of
301 an error during the unbundling. This output capturing part will likely be
302 reworked and this ability will probably go away in the process.
298 """ 303 """
299 if transactiongetter is None: 304 if op is None:
300 transactiongetter = _notransaction 305 if transactiongetter is None:
301 op = bundleoperation(repo, transactiongetter) 306 transactiongetter = _notransaction
307 op = bundleoperation(repo, transactiongetter)
302 # todo: 308 # todo:
303 # - replace this is a init function soon. 309 # - replace this is a init function soon.
304 # - exception catching 310 # - exception catching
305 unbundler.params 311 unbundler.params
306 iterparts = unbundler.iterparts() 312 iterparts = unbundler.iterparts()