# HG changeset patch # User David Demelier # Date 2017-08-21 06:52:46 # Node ID 10f1809ab98f18e7ad3284fcf5d3ec9b699c6e15 # Parent 078099304772925ddb583a3b34b8bff862adf3a2 bookmarks: allow renaming active bookmark using '.' diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -968,6 +968,7 @@ def bookmark(ui, repo, *names, **opts): raise error.Abort(_("new bookmark name required")) elif len(names) > 1: raise error.Abort(_("only one new bookmark name allowed")) + rename = repo._bookmarks.expandname(rename) bookmarks.rename(repo, tr, rename, names[0], force, inactive) elif names: bookmarks.addbookmarks(repo, tr, names, rev, force, inactive) diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t --- a/tests/test-bookmarks.t +++ b/tests/test-bookmarks.t @@ -191,6 +191,28 @@ force rename to existent bookmark $ hg bookmark -f -m X Y +rename bookmark using . + + $ hg book rename-me + $ hg book -m . renamed + $ hg bookmark + X2 1:925d80f479bb + Y 2:db815d6d32e6 + Z 0:f7b1eb17ad24 + * renamed 2:db815d6d32e6 + $ hg up -q Y + $ hg book -d renamed + +rename bookmark using . with no active bookmark + + $ hg book rename-me + $ hg book -i rename-me + $ hg book -m . renamed + abort: no active bookmark + [255] + $ hg up -q Y + $ hg book -d rename-me + list bookmarks $ hg bookmark