[PATCH] bookmarks: abort when incompatible options are used (issue3663)

Augie Fackler raf at durin42.com
Wed Oct 17 12:41:18 CDT 2012


queued, thanks

On Oct 17, 2012, at 4:54 AM, David Soria Parra <dsp+mercurial-devel at experimentalworks.net> wrote:

> # HG changeset patch
> # User David Soria Parra <dsp at php.net>
> # Date 1350467447 -7200
> # Node ID 046db30348709063b98a097dd4504c396cb8ca22
> # Parent  72c234081ae1350220132c69750f5a093902a1e7
> bookmarks: abort when incompatible options are used (issue3663)
> 
> Options like --delete and --rename are incompatible with each
> other. In this case we abort. We do not abort if the result is a nullop.
> Nullops are: '--delete --inactive', '--delete --force'.
> 
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -789,6 +789,13 @@
>     marks = repo._bookmarks
>     cur   = repo.changectx('.').node()
> 
> +    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
> @@ -223,6 +223,20 @@
>   abort: bookmark 'Z' already exists (use -f to force)
>   [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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list