jj/cli
Austin Seipp 2d0b6560e8 cli: allow multiple -r options for duplicate/abandon
Commands like `new`, `duplicate`, and `abandon` can take multiple revset
arguments which results in their collective union. They take the revisions
directly as arguments. But for consistency with many other commands, they can
also take the `-r` argument, which is a no-op. However, due to the flag being
specified as a `bool`, the `-r` option can only be specified once, so e.g.
`abandon -r x -r y` often fails. I normally use `-r` for consistency and muscle
memory, so this bites me often.

Instead, use `clap::ArgAction::Count` in order to allow `-r` to be specified
multiple times. It remains unused, of course.

With this change, all the following invocations are equivalent. Before this
change, the second example would fail due to  giving `-r` multiple times.

    jj abandon x y
    jj abandon -r x -r y
    jj abandon -r 'x | y'

Note: `jj new` already supported this exact case actually, but it used an
awkward trick where it used `.overrides_with()` in order to override *itself* so
it could be specified multiple times. I believe this is a bit clearer.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: Ib36cf81d46dae4f698f06d0a32e8fd3120bfb4a4
2024-03-28 15:29:47 -05:00
..
examples templater: leverage TemplateProperty::map/and_then() helpers 2024-03-23 16:22:17 +09:00
src cli: allow multiple -r options for duplicate/abandon 2024-03-28 15:29:47 -05:00
testing revset: substitute '~(::x)' to 'x..' 2024-03-17 14:50:48 +09:00
tests cli: allow multiple -r options for duplicate/abandon 2024-03-28 15:29:47 -05:00
build.rs
Cargo.toml test_conflicts and test_resolve_command: use indoc! to indent conflict markers in tests 2024-03-22 23:27:25 -07:00
LICENSE