comparison mercurial/exchange.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 6b81309d15a7
children e530cde6d115
comparison
equal deleted inserted replaced
24850:6b81309d15a7 24851:df0ce98c882f
1295 lock = repo.lock() 1295 lock = repo.lock()
1296 tr = repo.transaction(source) 1296 tr = repo.transaction(source)
1297 tr.hookargs['source'] = source 1297 tr.hookargs['source'] = source
1298 tr.hookargs['url'] = url 1298 tr.hookargs['url'] = url
1299 tr.hookargs['bundle2'] = '1' 1299 tr.hookargs['bundle2'] = '1'
1300 r = bundle2.processbundle(repo, cg, lambda: tr).reply 1300 op = bundle2.bundleoperation(repo, lambda: tr)
1301 if r is not None: 1301 try:
1302 repo.ui.pushbuffer(error=True, subproc=True) 1302 r = bundle2.processbundle(repo, cg, op=op)
1303 def recordout(output): 1303 finally:
1304 r.newpart('output', data=output, mandatory=False) 1304 r = op.reply
1305 if r is not None:
1306 repo.ui.pushbuffer(error=True, subproc=True)
1307 def recordout(output):
1308 r.newpart('output', data=output, mandatory=False)
1305 tr.close() 1309 tr.close()
1306 except Exception, exc: 1310 except Exception, exc:
1307 exc.duringunbundle2 = True 1311 exc.duringunbundle2 = True
1308 if r is not None: 1312 if r is not None:
1309 parts = exc._bundle2salvagedoutput = r.salvageoutput() 1313 parts = exc._bundle2salvagedoutput = r.salvageoutput()