Show More
@@ -150,6 +150,16 b' class pushoperation(object):' | |||
|
150 | 150 | else: |
|
151 | 151 | return self.fallbackheads |
|
152 | 152 | |
|
153 | # mapping of message used when pushing bookmark | |
|
154 | bookmsgmap = {'update': (_("updating bookmark %s\n"), | |
|
155 | _('updating bookmark %s failed!\n')), | |
|
156 | 'export': (_("exporting bookmark %s\n"), | |
|
157 | _('exporting bookmark %s failed!\n')), | |
|
158 | 'delete': (_("deleting remote bookmark %s\n"), | |
|
159 | _('deleting remote bookmark %s failed!\n')), | |
|
160 | } | |
|
161 | ||
|
162 | ||
|
153 | 163 | def push(repo, remote, force=False, revs=None, newbranch=False, bookmarks=()): |
|
154 | 164 | '''Push outgoing changesets (limited by revs) from a local |
|
155 | 165 | repository to remote. Return an integer: |
@@ -475,9 +485,17 b' def _pushb2bookmarks(pushop, bundler):' | |||
|
475 | 485 | part.addparam('key', enc(book)) |
|
476 | 486 | part.addparam('old', enc(old)) |
|
477 | 487 | part.addparam('new', enc(new)) |
|
478 | part2book.append((part.id, book)) | |
|
488 | action = 'update' | |
|
489 | if not old: | |
|
490 | action = 'export' | |
|
491 | elif not new: | |
|
492 | action = 'delete' | |
|
493 | part2book.append((part.id, book, action)) | |
|
494 | ||
|
495 | ||
|
479 | 496 | def handlereply(op): |
|
480 | for partid, book in part2book: | |
|
497 | ui = pushop.ui | |
|
498 | for partid, book, action in part2book: | |
|
481 | 499 | partrep = op.records.getreplies(partid) |
|
482 | 500 | results = partrep['pushkey'] |
|
483 | 501 | assert len(results) <= 1 |
@@ -486,9 +504,9 b' def _pushb2bookmarks(pushop, bundler):' | |||
|
486 | 504 | else: |
|
487 | 505 | ret = int(results[0]['return']) |
|
488 | 506 | if ret: |
|
489 |
|
|
|
507 | ui.status(bookmsgmap[action][0] % book) | |
|
490 | 508 | else: |
|
491 |
|
|
|
509 | ui.warn(bookmsgmap[action][1] % book) | |
|
492 | 510 | if pushop.bkresult is not None: |
|
493 | 511 | pushop.bkresult = 1 |
|
494 | 512 | return handlereply |
@@ -710,11 +728,20 b' def _pushbookmark(pushop):' | |||
|
710 | 728 | pushop.stepsdone.add('bookmarks') |
|
711 | 729 | ui = pushop.ui |
|
712 | 730 | remote = pushop.remote |
|
731 | ||
|
713 | 732 | for b, old, new in pushop.outbookmarks: |
|
733 | action = 'update' | |
|
734 | if not old: | |
|
735 | action = 'export' | |
|
736 | elif not new: | |
|
737 | action = 'delete' | |
|
714 | 738 | if remote.pushkey('bookmarks', b, old, new): |
|
715 |
ui.status( |
|
|
739 | ui.status(bookmsgmap[action][0] % b) | |
|
716 | 740 | else: |
|
717 |
ui.warn( |
|
|
741 | ui.warn(bookmsgmap[action][1] % b) | |
|
742 | # discovery can have set the value form invalid entry | |
|
743 | if pushop.bkresult is not None: | |
|
744 | pushop.bkresult = 1 | |
|
718 | 745 | |
|
719 | 746 | class pulloperation(object): |
|
720 | 747 | """A object that represent a single pull operation |
General Comments 0
You need to be logged in to leave comments.
Login now