diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -965,7 +965,7 @@ def addbookmarks(repo, tr, names, rev=No newact = mark if inactive and mark == repo._activebookmark: deactivate(repo) - return + continue tgt = cur if rev: ctx = scmutil.revsingle(repo, rev) @@ -976,6 +976,10 @@ def addbookmarks(repo, tr, names, rev=No changes.append((bm, None)) changes.append((mark, tgt)) + # nothing changed but for the one deactivated above + if not changes: + return + if hiddenrev: repo.ui.warn(_(b"bookmarking hidden changeset %s\n") % hiddenrev) diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t --- a/tests/test-bookmarks.t +++ b/tests/test-bookmarks.t @@ -608,6 +608,17 @@ activate bookmark on working dir parent $ hg bookmark --inactive Z $ hg bookmark Z +deactivate current 'Z', but also add 'Y' + + $ hg bookmark -d Y + $ hg bookmark --inactive Z Y + $ hg bookmark -l + X2 1:925d80f479bb + Y 2:db815d6d32e6 + Z 2:db815d6d32e6 + x y 2:db815d6d32e6 + $ hg bookmark Z + test clone $ hg bookmark -r 2 -i @