# HG changeset patch # User David Demelier # Date 1503298366 -7200 # Node ID 10f1809ab98f18e7ad3284fcf5d3ec9b699c6e15 # Parent 078099304772925ddb583a3b34b8bff862adf3a2 bookmarks: allow renaming active bookmark using '.' diff -r 078099304772 -r 10f1809ab98f mercurial/commands.py --- a/mercurial/commands.py Tue Aug 22 14:14:52 2017 -0400 +++ b/mercurial/commands.py Mon Aug 21 08:52:46 2017 +0200 @@ -968,6 +968,7 @@ 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 -r 078099304772 -r 10f1809ab98f tests/test-bookmarks.t --- a/tests/test-bookmarks.t Tue Aug 22 14:14:52 2017 -0400 +++ b/tests/test-bookmarks.t Mon Aug 21 08:52:46 2017 +0200 @@ -191,6 +191,28 @@ $ 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