##// END OF EJS Templates
bookmarks: abort the whole push if bookmarks fails to update (BC)...
Pierre-Yves David -
r25501:a99fee62 default
parent child Browse files
Show More
@@ -569,8 +569,17 b' def _pushb2bookmarks(pushop, bundler):'
569 pushop.stepsdone.add('bookmarks')
569 pushop.stepsdone.add('bookmarks')
570 part2book = []
570 part2book = []
571 enc = pushkey.encode
571 enc = pushkey.encode
572
573 def handlefailure(pushop, exc):
574 targetid = int(exc.partid)
575 for partid, book, action in part2book:
576 if partid == targetid:
577 raise error.Abort(bookmsgmap[action][1].rstrip() % book)
578 # we should not be called for part we did not generated
579 assert False
580
572 for book, old, new in pushop.outbookmarks:
581 for book, old, new in pushop.outbookmarks:
573 part = bundler.newpart('pushkey', mandatory=False)
582 part = bundler.newpart('pushkey')
574 part.addparam('namespace', enc('bookmarks'))
583 part.addparam('namespace', enc('bookmarks'))
575 part.addparam('key', enc(book))
584 part.addparam('key', enc(book))
576 part.addparam('old', enc(old))
585 part.addparam('old', enc(old))
@@ -581,7 +590,7 b' def _pushb2bookmarks(pushop, bundler):'
581 elif not new:
590 elif not new:
582 action = 'delete'
591 action = 'delete'
583 part2book.append((part.id, book, action))
592 part2book.append((part.id, book, action))
584
593 pushop.pkfailcb[part.id] = handlefailure
585
594
586 def handlereply(op):
595 def handlereply(op):
587 ui = pushop.ui
596 ui = pushop.ui
@@ -755,8 +755,8 b' Local push'
755 searching for changes
755 searching for changes
756 no changes found
756 no changes found
757 pushkey-abort: prepushkey hook exited with status 1
757 pushkey-abort: prepushkey hook exited with status 1
758 exporting bookmark @ failed!
758 abort: exporting bookmark @ failed!
759 [1]
759 [255]
760 $ hg -R ../issue4455-dest/ bookmarks
760 $ hg -R ../issue4455-dest/ bookmarks
761 no bookmarks set
761 no bookmarks set
762
762
@@ -768,8 +768,8 b' Using ssh'
768 searching for changes
768 searching for changes
769 no changes found
769 no changes found
770 remote: pushkey-abort: prepushkey hook exited with status 1
770 remote: pushkey-abort: prepushkey hook exited with status 1
771 exporting bookmark @ failed!
771 abort: exporting bookmark @ failed!
772 [1]
772 [255]
773 $ hg -R ../issue4455-dest/ bookmarks
773 $ hg -R ../issue4455-dest/ bookmarks
774 no bookmarks set
774 no bookmarks set
775
775
@@ -791,8 +791,8 b' Using http'
791 searching for changes
791 searching for changes
792 no changes found
792 no changes found
793 remote: pushkey-abort: prepushkey hook exited with status 1
793 remote: pushkey-abort: prepushkey hook exited with status 1
794 exporting bookmark @ failed!
794 abort: exporting bookmark @ failed!
795 [1]
795 [255]
796 $ hg -R ../issue4455-dest/ bookmarks
796 $ hg -R ../issue4455-dest/ bookmarks
797 no bookmarks set
797 no bookmarks set
798
798
@@ -271,11 +271,8 b' test that prepushkey can prevent incomin'
271 pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=push (glob)
271 pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=push (glob)
272 prepushkey.forbid hook: HG_BUNDLE2=1 HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_SOURCE=push HG_TXNID=TXN:* HG_URL=push (glob)
272 prepushkey.forbid hook: HG_BUNDLE2=1 HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_SOURCE=push HG_TXNID=TXN:* HG_URL=push (glob)
273 pushkey-abort: prepushkey hook exited with status 1
273 pushkey-abort: prepushkey hook exited with status 1
274 pretxnclose hook: HG_BUNDLE2=1 HG_SOURCE=push HG_TXNID=TXN:* HG_TXNNAME=push HG_URL=push (glob)
274 abort: exporting bookmark baz failed!
275 txnclose hook: HG_BUNDLE2=1 HG_SOURCE=push HG_TXNID=TXN:* HG_TXNNAME=push HG_URL=push (glob)
275 [255]
276 exporting bookmark baz failed!
277 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
278 [1]
279 $ cd ../a
276 $ cd ../a
280
277
281 test that prelistkeys can prevent listing keys
278 test that prelistkeys can prevent listing keys
General Comments 0
You need to be logged in to leave comments. Login now