##// END OF EJS Templates
push: prepare the issue of multiple kinds of messages...
Pierre-Yves David -
r22650:36952c91 default
parent child Browse files
Show More
@@ -150,6 +150,16 b' class pushoperation(object):'
150 else:
150 else:
151 return self.fallbackheads
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 def push(repo, remote, force=False, revs=None, newbranch=False, bookmarks=()):
163 def push(repo, remote, force=False, revs=None, newbranch=False, bookmarks=()):
154 '''Push outgoing changesets (limited by revs) from a local
164 '''Push outgoing changesets (limited by revs) from a local
155 repository to remote. Return an integer:
165 repository to remote. Return an integer:
@@ -475,9 +485,17 b' def _pushb2bookmarks(pushop, bundler):'
475 part.addparam('key', enc(book))
485 part.addparam('key', enc(book))
476 part.addparam('old', enc(old))
486 part.addparam('old', enc(old))
477 part.addparam('new', enc(new))
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 def handlereply(op):
496 def handlereply(op):
480 for partid, book in part2book:
497 ui = pushop.ui
498 for partid, book, action in part2book:
481 partrep = op.records.getreplies(partid)
499 partrep = op.records.getreplies(partid)
482 results = partrep['pushkey']
500 results = partrep['pushkey']
483 assert len(results) <= 1
501 assert len(results) <= 1
@@ -486,9 +504,9 b' def _pushb2bookmarks(pushop, bundler):'
486 else:
504 else:
487 ret = int(results[0]['return'])
505 ret = int(results[0]['return'])
488 if ret:
506 if ret:
489 pushop.ui.status(_("updating bookmark %s\n") % book)
507 ui.status(bookmsgmap[action][0] % book)
490 else:
508 else:
491 pushop.ui.warn(_('updating bookmark %s failed!\n') % book)
509 ui.warn(bookmsgmap[action][1] % book)
492 if pushop.bkresult is not None:
510 if pushop.bkresult is not None:
493 pushop.bkresult = 1
511 pushop.bkresult = 1
494 return handlereply
512 return handlereply
@@ -710,11 +728,20 b' def _pushbookmark(pushop):'
710 pushop.stepsdone.add('bookmarks')
728 pushop.stepsdone.add('bookmarks')
711 ui = pushop.ui
729 ui = pushop.ui
712 remote = pushop.remote
730 remote = pushop.remote
731
713 for b, old, new in pushop.outbookmarks:
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 if remote.pushkey('bookmarks', b, old, new):
738 if remote.pushkey('bookmarks', b, old, new):
715 ui.status(_("updating bookmark %s\n") % b)
739 ui.status(bookmsgmap[action][0] % b)
716 else:
740 else:
717 ui.warn(_('updating bookmark %s failed!\n') % b)
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 class pulloperation(object):
746 class pulloperation(object):
720 """A object that represent a single pull operation
747 """A object that represent a single pull operation
General Comments 0
You need to be logged in to leave comments. Login now