comparison mercurial/commands.py @ 28182:e4fe4e903e97

bookmarks: add 'hg push -B .' for pushing the active bookmark (issue4917)
author liscju <piotr.listkiewicz@gmail.com>
date Fri, 19 Feb 2016 22:28:09 +0100
parents bd97ed121016
children 7623ba92af72
comparison
equal deleted inserted replaced
28181:f8efc8a3a991 28182:e4fe4e903e97
5706 If -r/--rev is used, the specified revision and all its ancestors 5706 If -r/--rev is used, the specified revision and all its ancestors
5707 will be pushed to the remote repository. 5707 will be pushed to the remote repository.
5708 5708
5709 If -B/--bookmark is used, the specified bookmarked revision, its 5709 If -B/--bookmark is used, the specified bookmarked revision, its
5710 ancestors, and the bookmark will be pushed to the remote 5710 ancestors, and the bookmark will be pushed to the remote
5711 repository. 5711 repository. Specifying ``.`` is equivalent to specifying the active
5712 bookmark's name.
5712 5713
5713 Please see :hg:`help urls` for important details about ``ssh://`` 5714 Please see :hg:`help urls` for important details about ``ssh://``
5714 URLs. If DESTINATION is omitted, a default path will be used. 5715 URLs. If DESTINATION is omitted, a default path will be used.
5715 5716
5716 Returns 0 if push was successful, 1 if nothing to push. 5717 Returns 0 if push was successful, 1 if nothing to push.
5718 5719
5719 if opts.get('bookmark'): 5720 if opts.get('bookmark'):
5720 ui.setconfig('bookmarks', 'pushing', opts['bookmark'], 'push') 5721 ui.setconfig('bookmarks', 'pushing', opts['bookmark'], 'push')
5721 for b in opts['bookmark']: 5722 for b in opts['bookmark']:
5722 # translate -B options to -r so changesets get pushed 5723 # translate -B options to -r so changesets get pushed
5724 b = repo._bookmarks.expandname(b)
5723 if b in repo._bookmarks: 5725 if b in repo._bookmarks:
5724 opts.setdefault('rev', []).append(b) 5726 opts.setdefault('rev', []).append(b)
5725 else: 5727 else:
5726 # if we try to push a deleted bookmark, translate it to null 5728 # if we try to push a deleted bookmark, translate it to null
5727 # this lets simultaneous -r, -b options continue working 5729 # this lets simultaneous -r, -b options continue working