-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Change-Id: Ib36cf81d46dae4f698f06d0a32e8fd3120bfb4a4
- Loading branch information
1 parent
916dc30
commit b87b23f
Showing
5 changed files
with
9 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters