Mercurial > hg
changeset 33913:5cd6d4826f9f
bookmarks: allow deleting active bookmark using '.'
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 24 Aug 2017 09:23:06 +0200 |
parents | e278d6d2d7d2 |
children | a0aeb096bb12 |
files | mercurial/commands.py tests/test-bookmarks.t |
diffstat | 2 files changed, 24 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Thu Aug 17 18:26:11 2017 +0200 +++ b/mercurial/commands.py Thu Aug 24 09:23:06 2017 +0200 @@ -917,6 +917,9 @@ diverged, a new 'divergent bookmark' of the form 'name@path' will be created. Using :hg:`merge` will resolve the divergence. + Specifying bookmark as '.' to -m or -d options is equivalent to specifying + the active bookmark's name. + A bookmark named '@' has the special property that :hg:`clone` will check it out by default if it exists. @@ -962,6 +965,7 @@ if delete or rename or names or inactive: with repo.wlock(), repo.lock(), repo.transaction('bookmark') as tr: if delete: + names = pycompat.maplist(repo._bookmarks.expandname, names) bookmarks.delete(repo, tr, names) elif rename: if not names:
--- a/tests/test-bookmarks.t Thu Aug 17 18:26:11 2017 +0200 +++ b/tests/test-bookmarks.t Thu Aug 24 09:23:06 2017 +0200 @@ -213,6 +213,26 @@ $ hg up -q Y $ hg book -d rename-me +delete bookmark using . + + $ hg book delete-me + $ hg book -d . + $ hg bookmark + X2 1:925d80f479bb + Y 2:db815d6d32e6 + Z 0:f7b1eb17ad24 + $ hg up -q Y + +delete bookmark using . with no active bookmark + + $ hg book delete-me + $ hg book -i delete-me + $ hg book -d . + abort: no active bookmark + [255] + $ hg up -q Y + $ hg book -d delete-me + list bookmarks $ hg bookmark