diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -807,6 +807,13 @@ def bookmark(ui, repo, mark=None, rev=No raise util.Abort( _("a bookmark cannot have the name of an existing branch")) + if delete and rename: + raise util.Abort(_("--delete and --rename are incompatible")) + if delete and rev: + raise util.Abort(_("--rev is incompatible with --delete")) + if rename and rev: + raise util.Abort(_("--rev is incompatible with --rename")) + if delete: if mark is None: raise util.Abort(_("bookmark name required")) diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t --- a/tests/test-bookmarks.t +++ b/tests/test-bookmarks.t @@ -242,6 +242,20 @@ bookmark with name of branch abort: a bookmark cannot have the name of an existing branch [255] +incompatible options + + $ hg bookmark -m Y -d Z + abort: --delete and --rename are incompatible + [255] + + $ hg bookmark -r 1 -d Z + abort: --rev is incompatible with --delete + [255] + + $ hg bookmark -r 1 -m Z Y + abort: --rev is incompatible with --rename + [255] + force bookmark with existing name $ hg bookmark -f Z