Mercurial > hg-stable
changeset 14188:9029b1a38c30
bookmarks: allow to create/move bookmark without making it current (issue2788)
Adds a -i/--inactive flag to the bookmarks command to create or move a
bookmark without making it the current one. This lets you use a bookmark
like a shareable, movable 'tag' and less like a 'branch'.
Thanks to Alexander Solovyov <alexander@solovyov.net> for most of the
work of implementation, and Matt Mackall <mpm@selenic.com> for
suggesting the option name.
author | Kevin Bullock <kbullock@ringworld.org> |
---|---|
date | Sat, 11 Dec 2010 18:08:55 +0100 |
parents | 9bbaafddfa90 |
children | 328422b0380d |
files | mercurial/commands.py tests/test-bookmarks-current.t |
diffstat | 2 files changed, 14 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Thu May 05 01:57:13 2011 +0200 +++ b/mercurial/commands.py Sat Dec 11 18:08:55 2010 +0100 @@ -483,7 +483,8 @@ cmdutil.bail_if_changed(repo) return hg.clean(repo, node) -def bookmark(ui, repo, mark=None, rev=None, force=False, delete=False, rename=None): +def bookmark(ui, repo, mark=None, rev=None, force=False, delete=False, + rename=None, inactive=False): '''track a line of development with movable markers Bookmarks are pointers to certain commits that move when @@ -514,7 +515,7 @@ if mark is None: raise util.Abort(_("new bookmark name required")) marks[mark] = marks[rename] - if repo._bookmarkcurrent == rename: + if repo._bookmarkcurrent == rename and not inactive: bookmarks.setcurrent(repo, mark) del marks[rename] bookmarks.write(repo) @@ -549,7 +550,7 @@ marks[mark] = repo.lookup(rev) else: marks[mark] = repo.changectx('.').node() - if repo.changectx('.').node() == marks[mark]: + if not inactive and repo.changectx('.').node() == marks[mark]: bookmarks.setcurrent(repo, mark) bookmarks.write(repo) return @@ -4469,8 +4470,9 @@ [('f', 'force', False, _('force')), ('r', 'rev', '', _('revision'), _('REV')), ('d', 'delete', False, _('delete a given bookmark')), - ('m', 'rename', '', _('rename a given bookmark'), _('NAME'))], - _('hg bookmarks [-f] [-d] [-m NAME] [-r REV] [NAME]')), + ('m', 'rename', '', _('rename a given bookmark'), _('NAME')), + ('i', 'inactive', False, _('do not mark a new bookmark active'))], + _('hg bookmarks [-f] [-d] [-i] [-m NAME] [-r REV] [NAME]')), "branch": (branch, [('f', 'force', None,