Mercurial > hg
comparison mercurial/exchange.py @ 24847:b705e5ab3b07 stable
bundle2: capture transaction rollback message output (issue4614)
The output from the transaction rollback was not included into the reply bundle.
It was eventually caught by the usual 'unbundle' output capture and sent to the
client but the result was out of order on the client side. We now capture the
output for the transaction release and transmit it the same way as all other
output.
We should probably rethink the whole output capture things but this would not be
appropriate for stable.
The is still multiple cases were output failed to be properly capture, they will
be fixed in later changesets.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 23 Apr 2015 14:20:36 +0100 |
parents | f9aa4cb8f2dd |
children | aff2aca3420e |
comparison
equal
deleted
inserted
replaced
24846:e79dd1c9753e | 24847:b705e5ab3b07 |
---|---|
1282 | 1282 |
1283 If the push was raced as PushRaced exception is raised.""" | 1283 If the push was raced as PushRaced exception is raised.""" |
1284 r = 0 | 1284 r = 0 |
1285 # need a transaction when processing a bundle2 stream | 1285 # need a transaction when processing a bundle2 stream |
1286 wlock = lock = tr = None | 1286 wlock = lock = tr = None |
1287 recordout = None | |
1287 try: | 1288 try: |
1288 check_heads(repo, heads, 'uploading changes') | 1289 check_heads(repo, heads, 'uploading changes') |
1289 # push can proceed | 1290 # push can proceed |
1290 if util.safehasattr(cg, 'params'): | 1291 if util.safehasattr(cg, 'params'): |
1291 r = None | 1292 r = None |
1299 r = bundle2.processbundle(repo, cg, lambda: tr).reply | 1300 r = bundle2.processbundle(repo, cg, lambda: tr).reply |
1300 tr.close() | 1301 tr.close() |
1301 except Exception, exc: | 1302 except Exception, exc: |
1302 exc.duringunbundle2 = True | 1303 exc.duringunbundle2 = True |
1303 if r is not None: | 1304 if r is not None: |
1304 exc._bundle2salvagedoutput = r.salvageoutput() | 1305 parts = exc._bundle2salvagedoutput = r.salvageoutput() |
1306 repo.ui.pushbuffer(error=True) | |
1307 def recordout(output): | |
1308 part = bundle2.bundlepart('output', data=output, | |
1309 mandatory=False) | |
1310 parts.append(part) | |
1305 raise | 1311 raise |
1306 else: | 1312 else: |
1307 lock = repo.lock() | 1313 lock = repo.lock() |
1308 r = changegroup.addchangegroup(repo, cg, source, url) | 1314 r = changegroup.addchangegroup(repo, cg, source, url) |
1309 finally: | 1315 finally: |
1310 lockmod.release(tr, lock, wlock) | 1316 lockmod.release(tr, lock, wlock) |
1317 if recordout is not None: | |
1318 recordout(repo.ui.popbuffer()) | |
1311 return r | 1319 return r |