jj/cli/tests
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
..
common cli: show timestamp in local timezone and without millis and offset 2024-03-20 07:54:08 -07:00
cli-reference@.md.snap cli: allow multiple -r options for duplicate/abandon 2024-03-28 15:29:47 -05:00
runner.rs compile integration tests as a single binary 2024-02-06 18:19:41 -08:00
test_abandon_command.rs cli: show timestamp in local timezone and without millis and offset 2024-03-20 07:54:08 -07:00
test_alias.rs cli: add "Hint: " or "Warning: " heading to almost all messages 2024-03-26 11:23:13 +09:00
test_branch_command.rs cli: add "Hint: " or "Warning: " heading to almost all messages 2024-03-26 11:23:13 +09:00
test_builtin_aliases.rs cli: show timestamp in local timezone and without millis and offset 2024-03-20 07:54:08 -07:00
test_cat_command.rs compile integration tests as a single binary 2024-02-06 18:19:41 -08:00
test_checkout.rs cli: add convenient methods to print hint or warning with default headings 2024-03-26 00:28:27 +09:00
test_chmod_command.rs git_backend: write trees involved in conflict in git commit header 2024-03-10 20:51:05 -07:00
test_commit_command.rs cli: add "Hint: " or "Warning: " heading to almost all messages 2024-03-26 11:23:13 +09:00
test_commit_template.rs revset, templater: include short parse error description in summary line 2024-03-28 10:53:06 +09:00
test_concurrent_operations.rs op_store: add metadata flag for ops representing working-copy snapshot 2024-02-19 22:44:38 -08:00
test_config_command.rs cli: add "Hint: " or "Warning: " heading to almost all messages 2024-03-26 11:23:13 +09:00
test_debug_command.rs debug-tree: allow looking up tree by path and id, not just revision 2024-03-14 23:28:59 -07:00
test_describe_command.rs compile integration tests as a single binary 2024-02-06 18:19:41 -08:00
test_diff_command.rs cli: add "Hint: " or "Warning: " heading to almost all messages 2024-03-26 11:23:13 +09:00
test_diffedit_command.rs git_backend: write trees involved in conflict in git commit header 2024-03-10 20:51:05 -07:00
test_duplicate_command.rs cli: make "duplicate none()" exit successfully 2024-03-18 09:32:35 +09:00
test_edit_command.rs compile integration tests as a single binary 2024-02-06 18:19:41 -08:00
test_generate_md_cli_help.rs docs, CLI reference: use include-markdown instead of a symlink 2024-02-12 10:28:09 -08:00
test_git_clone.rs cli: list new remote branches during git fetch 2024-02-18 17:36:01 +01:00
test_git_colocated.rs cli: add "Hint: " or "Warning: " heading to almost all messages 2024-03-26 11:23:13 +09:00
test_git_fetch.rs cli: add "Hint: " or "Warning: " heading to almost all messages 2024-03-26 11:23:13 +09:00
test_git_import_export.rs cli: add "Hint: " or "Warning: " heading to almost all messages 2024-03-26 11:23:13 +09:00
test_git_init.rs cli: add "Hint: " or "Warning: " heading to almost all messages 2024-03-26 11:23:13 +09:00
test_git_push.rs cli: add "Hint: " or "Warning: " heading to almost all messages 2024-03-26 11:23:13 +09:00
test_git_remotes.rs compile integration tests as a single binary 2024-02-06 18:19:41 -08:00
test_git_submodule.rs compile integration tests as a single binary 2024-02-06 18:19:41 -08:00
test_gitignores.rs cli: add "Hint: " or "Warning: " heading to almost all messages 2024-03-26 11:23:13 +09:00
test_global_opts.rs cli: colorize commits summary embedded in single revset resolution hint 2024-03-27 09:06:06 +09:00
test_immutable_commits.rs cli: add convenient methods to print hint or warning with default headings 2024-03-26 00:28:27 +09:00
test_init_command.rs cli: add "Hint: " or "Warning: " heading to almost all messages 2024-03-26 11:23:13 +09:00
test_interdiff_command.rs compile integration tests as a single binary 2024-02-06 18:19:41 -08:00
test_log_command.rs revset, templater: render parse error as usual error chain 2024-03-28 10:53:06 +09:00
test_move_command.rs cli: add convenient methods to print hint or warning with default headings 2024-03-26 00:28:27 +09:00
test_new_command.rs cli: add convenient methods to print hint or warning with default headings 2024-03-26 00:28:27 +09:00
test_next_prev_commands.rs next, prev: fix choice from more than two targets 2024-03-25 20:51:54 +09:00
test_obslog_command.rs Make node symbols templatable in the graphs. 2024-03-21 17:41:31 +01:00
test_operations.rs cli: add "Hint: " or "Warning: " heading to almost all messages 2024-03-26 11:23:13 +09:00
test_rebase_command.rs cli: indent commits summary in single revset resolution hint 2024-03-25 11:15:28 +09:00
test_repo_change_report.rs git_backend: write trees involved in conflict in git commit header 2024-03-10 20:51:05 -07:00
test_resolve_command.rs cli: add "Hint: " or "Warning: " heading to almost all messages 2024-03-26 11:23:13 +09:00
test_restore_command.rs git_backend: write trees involved in conflict in git commit header 2024-03-10 20:51:05 -07:00
test_revset_output.rs revset: use common argument error instead of FsPathParseError 2024-03-28 10:53:06 +09:00
test_root.rs compile integration tests as a single binary 2024-02-06 18:19:41 -08:00
test_shell_completion.rs compile integration tests as a single binary 2024-02-06 18:19:41 -08:00
test_show_command.rs cli: show timestamp in local timezone and without millis and offset 2024-03-20 07:54:08 -07:00
test_sparse_command.rs compile integration tests as a single binary 2024-02-06 18:19:41 -08:00
test_split_command.rs cli: add "Hint: " or "Warning: " heading to almost all messages 2024-03-26 11:23:13 +09:00
test_squash_command.rs cli: add convenient methods to print hint or warning with default headings 2024-03-26 00:28:27 +09:00
test_status_command.rs compile integration tests as a single binary 2024-02-06 18:19:41 -08:00
test_tag_command.rs compile integration tests as a single binary 2024-02-06 18:19:41 -08:00
test_templater.rs revset, templater: include short parse error description in summary line 2024-03-28 10:53:06 +09:00
test_tree_level_conflicts.rs cli: show timestamp in local timezone and without millis and offset 2024-03-20 07:54:08 -07:00
test_undo.rs compile integration tests as a single binary 2024-02-06 18:19:41 -08:00
test_unsquash_command.rs description_utils: teach combine_messages() to handle more than two sources 2024-03-13 05:21:05 -07:00
test_untrack_command.rs compile integration tests as a single binary 2024-02-06 18:19:41 -08:00
test_util_command.rs op_store: add metadata flag for ops representing working-copy snapshot 2024-02-19 22:44:38 -08:00
test_working_copy.rs compile integration tests as a single binary 2024-02-06 18:19:41 -08:00
test_workspaces.rs cli: show timestamp in local timezone and without millis and offset 2024-03-20 07:54:08 -07:00