Mercurial > public > mercurial-scm > hg
diff mercurial/exchange.py @ 25501:a99fee62611d
bookmarks: abort the whole push if bookmarks fails to update (BC)
When using bundle2, the bookmark's 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:33 -0700 |
parents | 8182163ae983 |
children | bd41c19383db |
line wrap: on
line diff
--- a/mercurial/exchange.py Mon Jun 08 16:55:21 2015 -0700 +++ b/mercurial/exchange.py Wed May 27 22:25:33 2015 -0700 @@ -569,8 +569,17 @@ pushop.stepsdone.add('bookmarks') part2book = [] enc = pushkey.encode + + def handlefailure(pushop, exc): + targetid = int(exc.partid) + for partid, book, action in part2book: + if partid == targetid: + raise error.Abort(bookmsgmap[action][1].rstrip() % book) + # we should not be called for part we did not generated + assert False + for book, old, new in pushop.outbookmarks: - part = bundler.newpart('pushkey', mandatory=False) + part = bundler.newpart('pushkey') part.addparam('namespace', enc('bookmarks')) part.addparam('key', enc(book)) part.addparam('old', enc(old)) @@ -581,7 +590,7 @@ elif not new: action = 'delete' part2book.append((part.id, book, action)) - + pushop.pkfailcb[part.id] = handlefailure def handlereply(op): ui = pushop.ui