[PATCH] bookmarks: allow renaming active bookmark using '.'

Yuya Nishihara yuya at tcha.org
Wed Aug 23 09:59:10 EDT 2017


On Mon, 21 Aug 2017 09:06:50 +0200, David Demelier wrote:
> # HG changeset patch
> # User David Demelier <markand at malikania.fr>
> # Date 1503298366 -7200
> #      Mon Aug 21 08:52:46 2017 +0200
> # Node ID f6ee280ea6afef475c3d158c4c4964a05be6ef15
> # Parent  1e71a27dee970ec9ef02c004f662b5a99182f69b
> bookmarks: allow renaming active bookmark using '.'

I like the idea.

> --- a/mercurial/bookmarks.py	Sun Aug 13 00:17:13 2017 -0700
> +++ b/mercurial/bookmarks.py	Mon Aug 21 08:52:46 2017 +0200
> @@ -763,7 +763,11 @@
>      """
>      marks = repo._bookmarks
>      mark = checkformat(repo, new)
> -    if old not in marks:
> +    if old == ".":
> +        if not repo._activebookmark:
> +            raise error.Abort(_("no active bookmark to rename"))
> +        old = repo._activebookmark
> +    elif old not in marks:

Perhaps bookmarks.expandname() could be used, and I slightly prefer resolving
"." in commands.py since that seems more like a UI stuff.


More information about the Mercurial-devel mailing list