[PATCH] bookmarks: allow to create/move bookmark without making it current (issue2788)
timeless
timeless at gmail.com
Wed May 4 02:20:22 CDT 2011
I expect someone will hate me, but...
Do we want to consider reserving a short flag for a global --interactive option?
On 5/4/11, Kevin Bullock <kbullock+mercurial at ringworld.org> wrote:
> # HG changeset patch
> # User Kevin Bullock <kbullock at ringworld.org>
> # Date 1292087335 -3600
> # Node ID a75e92bcfe2581ddaaf9d00a8373f8fa722d2577
> # Parent bf951d58b9172e3dee1be36032784956e5775636
> 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 at solovyov.net> for most of the
> work of implementation, and Matt Mackall <mpm at selenic.com> for
> suggesting the option name.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -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,
> diff --git a/tests/test-bookmarks-current.t b/tests/test-bookmarks-current.t
> --- a/tests/test-bookmarks-current.t
> +++ b/tests/test-bookmarks-current.t
> @@ -99,3 +99,10 @@
>
> $ hg bookmark
> * Y 0:719295282060
> +
> +set bookmark Z using -i
> +
> + $ hg bookmark -r . -i Z
> + $ hg bookmarks
> + * Y 0:719295282060
> + Z 0:719295282060
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
--
Sent from my mobile device
More information about the Mercurial-devel
mailing list