diff -r 6b81309d15a7 -r df0ce98c882f mercurial/exchange.py --- a/mercurial/exchange.py Thu Apr 23 14:54:45 2015 +0100 +++ b/mercurial/exchange.py Thu Apr 23 16:36:18 2015 +0100 @@ -1297,11 +1297,15 @@ tr.hookargs['source'] = source tr.hookargs['url'] = url tr.hookargs['bundle2'] = '1' - r = bundle2.processbundle(repo, cg, lambda: tr).reply - if r is not None: - repo.ui.pushbuffer(error=True, subproc=True) - def recordout(output): - r.newpart('output', data=output, mandatory=False) + op = bundle2.bundleoperation(repo, lambda: tr) + try: + r = bundle2.processbundle(repo, cg, op=op) + finally: + r = op.reply + if r is not None: + repo.ui.pushbuffer(error=True, subproc=True) + def recordout(output): + r.newpart('output', data=output, mandatory=False) tr.close() except Exception, exc: exc.duringunbundle2 = True