diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -539,6 +539,9 @@ def bookmark(ui, repo, mark=None, rev=No if not mark: raise util.Abort(_("bookmark names cannot consist entirely of " "whitespace")) + if inactive and mark == repo._bookmarkcurrent: + bookmarks.setcurrent(repo, None) + return if mark in marks and not force: raise util.Abort(_("bookmark '%s' already exists " "(use -f to force)") % mark) 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 @@ -106,3 +106,22 @@ set bookmark Z using -i $ hg bookmarks * Y 0:719295282060 Z 0:719295282060 + +deactivate current bookmark using -i + + $ hg bookmark -i Y + $ hg bookmarks + Y 0:719295282060 + Z 0:719295282060 + + $ hg up -q Y + $ hg bookmarks + * Y 0:719295282060 + Z 0:719295282060 + +deactivate current bookmark while renaming + + $ hg bookmark -i -m Y X + $ hg bookmarks + X 0:719295282060 + Z 0:719295282060 diff --git a/tests/test-debugcomplete.t b/tests/test-debugcomplete.t --- a/tests/test-debugcomplete.t +++ b/tests/test-debugcomplete.t @@ -205,7 +205,7 @@ Show all commands + options archive: no-decode, prefix, rev, type, subrepos, include, exclude backout: merge, parent, tool, rev, include, exclude, message, logfile, date, user bisect: reset, good, bad, skip, extend, command, noupdate - bookmarks: force, rev, delete, rename + bookmarks: force, rev, delete, rename, inactive branch: force, clean branches: active, closed bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure