Mercurial > hg-stable
comparison mercurial/commands.py @ 20026:84905561ad41
bookmarks: rewrite pushing local bookmarks in "commands.push()" by "compare()"
This patch adds "pushtoremote()", which uses "compare()" to compare
bookmarks between the local and the remote repositories, to replace
pushing local bookmarks in "commands.push()".
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 08 Nov 2013 12:45:52 +0900 |
parents | de16c673455b |
children | 1e5b38a919dd |
comparison
equal
deleted
inserted
replaced
20025:e8a11791abfc | 20026:84905561ad41 |
---|---|
4709 newbranch=opts.get('new_branch')) | 4709 newbranch=opts.get('new_branch')) |
4710 | 4710 |
4711 result = not result | 4711 result = not result |
4712 | 4712 |
4713 if opts.get('bookmark'): | 4713 if opts.get('bookmark'): |
4714 rb = other.listkeys('bookmarks') | 4714 bresult = bookmarks.pushtoremote(ui, repo, other, opts['bookmark']) |
4715 for b in opts['bookmark']: | 4715 if bresult == 2: |
4716 # explicit push overrides remote bookmark if any | 4716 return 2 |
4717 if b in repo._bookmarks: | 4717 if not result and bresult: |
4718 ui.status(_("exporting bookmark %s\n") % b) | 4718 result = 2 |
4719 new = repo[b].hex() | |
4720 elif b in rb: | |
4721 ui.status(_("deleting remote bookmark %s\n") % b) | |
4722 new = '' # delete | |
4723 else: | |
4724 ui.warn(_('bookmark %s does not exist on the local ' | |
4725 'or remote repository!\n') % b) | |
4726 return 2 | |
4727 old = rb.get(b, '') | |
4728 r = other.pushkey('bookmarks', b, old, new) | |
4729 if not r: | |
4730 ui.warn(_('updating bookmark %s failed!\n') % b) | |
4731 if not result: | |
4732 result = 2 | |
4733 | 4719 |
4734 return result | 4720 return result |
4735 | 4721 |
4736 @command('recover', []) | 4722 @command('recover', []) |
4737 def recover(ui, repo): | 4723 def recover(ui, repo): |