Mercurial > public > mercurial-scm > hg-stable
diff mercurial/exchange.py @ 25502:bd41c19383db
phases: abort the whole push if phases fail to update (BC)
When using bundle2, the phase pushkey parts are now made mandatory. As a
result, failure to update the bookmark server side will result in the transaction
being aborted.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 27 May 2015 22:25:51 -0700 |
parents | a99fee62611d |
children | 1b7853a1f04e |
line wrap: on
line diff
--- a/mercurial/exchange.py Wed May 27 22:25:33 2015 -0700 +++ b/mercurial/exchange.py Wed May 27 22:25:51 2015 -0700 @@ -524,14 +524,23 @@ return pushop.stepsdone.add('phases') part2node = [] + + def handlefailure(pushop, exc): + targetid = int(exc.partid) + for partid, node in part2node: + if partid == targetid: + raise error.Abort(_('updating %s to public failed') % node) + enc = pushkey.encode for newremotehead in pushop.outdatedphases: - part = bundler.newpart('pushkey', mandatory=False) + part = bundler.newpart('pushkey') part.addparam('namespace', enc('phases')) part.addparam('key', enc(newremotehead.hex())) part.addparam('old', enc(str(phases.draft))) part.addparam('new', enc(str(phases.public))) part2node.append((part.id, newremotehead)) + pushop.pkfailcb[part.id] = handlefailure + def handlereply(op): for partid, node in part2node: partrep = op.records.getreplies(partid)