just playing with tangled
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cli: provide short flags for rev ranges

+40 -24
+7
CHANGELOG.md
··· 51 51 * The `tags()` revset function now takes an optional `pattern` argument, 52 52 mirroring that of `bookmarks()`. 53 53 54 + * Several commands now support `-f/-t` shorthands for `--from/--to`: 55 + - `diff` 56 + - `diffedit` 57 + - `interdiff` 58 + - `op diff` 59 + - `restore` 60 + 54 61 ### Fixed bugs 55 62 56 63 * `jj config unset <TABLE-NAME>` no longer removes a table (such as `[ui]`.)
+2 -2
cli/src/commands/diff.rs
··· 51 51 #[arg(long, short, add = ArgValueCandidates::new(complete::all_revisions))] 52 52 revision: Option<RevisionArg>, 53 53 /// Show changes from this revision 54 - #[arg(long, conflicts_with = "revision", add = ArgValueCandidates::new(complete::all_revisions))] 54 + #[arg(long, short, conflicts_with = "revision", add = ArgValueCandidates::new(complete::all_revisions))] 55 55 from: Option<RevisionArg>, 56 56 /// Show changes to this revision 57 - #[arg(long, conflicts_with = "revision", add = ArgValueCandidates::new(complete::all_revisions))] 57 + #[arg(long, short, conflicts_with = "revision", add = ArgValueCandidates::new(complete::all_revisions))] 58 58 to: Option<RevisionArg>, 59 59 /// Restrict the diff to these paths 60 60 #[arg(value_hint = clap::ValueHint::AnyPath)]
+10 -2
cli/src/commands/diffedit.rs
··· 55 55 /// Show changes from this revision 56 56 /// 57 57 /// Defaults to @ if --to is specified. 58 - #[arg(long, conflicts_with = "revision", add = ArgValueCandidates::new(complete::all_revisions))] 58 + #[arg( 59 + long, short, 60 + conflicts_with = "revision", 61 + add = ArgValueCandidates::new(complete::all_revisions), 62 + )] 59 63 from: Option<RevisionArg>, 60 64 /// Edit changes in this revision 61 65 /// 62 66 /// Defaults to @ if --from is specified. 63 - #[arg(long, conflicts_with = "revision", add = ArgValueCandidates::new(complete::mutable_revisions))] 67 + #[arg( 68 + long, short, 69 + conflicts_with = "revision", 70 + add = ArgValueCandidates::new(complete::mutable_revisions), 71 + )] 64 72 to: Option<RevisionArg>, 65 73 /// Specify diff editor to be used 66 74 #[arg(long, value_name = "NAME")]
+2 -2
cli/src/commands/interdiff.rs
··· 36 36 #[command(mut_arg("ignore_space_change", |a| a.short('b')))] 37 37 pub(crate) struct InterdiffArgs { 38 38 /// Show changes from this revision 39 - #[arg(long, add = ArgValueCandidates::new(complete::all_revisions))] 39 + #[arg(long, short, add = ArgValueCandidates::new(complete::all_revisions))] 40 40 from: Option<RevisionArg>, 41 41 /// Show changes to this revision 42 - #[arg(long, add = ArgValueCandidates::new(complete::all_revisions))] 42 + #[arg(long, short, add = ArgValueCandidates::new(complete::all_revisions))] 43 43 to: Option<RevisionArg>, 44 44 /// Restrict the diff to these paths 45 45 #[arg(value_hint = clap::ValueHint::AnyPath)]
+2 -2
cli/src/commands/operation/diff.rs
··· 65 65 operation: Option<String>, 66 66 /// Show repository changes from this operation 67 67 #[arg( 68 - long, 68 + long, short, 69 69 conflicts_with = "operation", 70 70 add = ArgValueCandidates::new(complete::operations), 71 71 )] 72 72 from: Option<String>, 73 73 /// Show repository changes to this operation 74 74 #[arg( 75 - long, 75 + long, short, 76 76 conflicts_with = "operation", 77 77 add = ArgValueCandidates::new(complete::operations), 78 78 )]
+2 -2
cli/src/commands/restore.rs
··· 48 48 #[arg(value_hint = clap::ValueHint::AnyPath)] 49 49 paths: Vec<String>, 50 50 /// Revision to restore from (source) 51 - #[arg(long, add = ArgValueCandidates::new(complete::all_revisions))] 51 + #[arg(long, short, add = ArgValueCandidates::new(complete::all_revisions))] 52 52 from: Option<RevisionArg>, 53 53 /// Revision to restore into (destination) 54 - #[arg(long, add = ArgValueCandidates::new(complete::mutable_revisions))] 54 + #[arg(long, short, add = ArgValueCandidates::new(complete::mutable_revisions))] 55 55 to: Option<RevisionArg>, 56 56 /// Undo the changes in a revision as compared to the merge of its parents. 57 57 ///
+11 -10
cli/tests/cli-reference@.md.snap
··· 1 1 --- 2 2 source: cli/tests/test_generate_md_cli_help.rs 3 3 description: "AUTO-GENERATED FILE, DO NOT EDIT. This cli reference is generated by a test as an `insta` snapshot. MkDocs includes this snapshot from docs/cli-reference.md." 4 + snapshot_kind: text 4 5 --- 5 6 <!-- BEGIN MARKDOWN--> 6 7 ··· 689 690 * `-r`, `--revision <REVISION>` — Show changes in this revision, compared to its parent(s) 690 691 691 692 If the revision is a merge commit, this shows changes *from* the automatic merge of the contents of all of its parents *to* the contents of the revision itself. 692 - * `--from <FROM>` — Show changes from this revision 693 - * `--to <TO>` — Show changes to this revision 693 + * `-f`, `--from <FROM>` — Show changes from this revision 694 + * `-t`, `--to <TO>` — Show changes to this revision 694 695 * `-s`, `--summary` — For each path, show only whether it was modified, added, or deleted 695 696 * `--stat` — Show a histogram of the changes 696 697 * `--types` — For each path, show only its type before and after ··· 729 730 * `-r`, `--revision <REVISION>` — The revision to touch up 730 731 731 732 Defaults to @ if neither --to nor --from are specified. 732 - * `--from <FROM>` — Show changes from this revision 733 + * `-f`, `--from <FROM>` — Show changes from this revision 733 734 734 735 Defaults to @ if --to is specified. 735 - * `--to <TO>` — Edit changes in this revision 736 + * `-t`, `--to <TO>` — Edit changes in this revision 736 737 737 738 Defaults to @ if --from is specified. 738 739 * `--tool <NAME>` — Specify diff editor to be used ··· 1316 1317 1317 1318 ###### **Options:** 1318 1319 1319 - * `--from <FROM>` — Show changes from this revision 1320 - * `--to <TO>` — Show changes to this revision 1320 + * `-f`, `--from <FROM>` — Show changes from this revision 1321 + * `-t`, `--to <TO>` — Show changes to this revision 1321 1322 * `-s`, `--summary` — For each path, show only whether it was modified, added, or deleted 1322 1323 * `--stat` — Show a histogram of the changes 1323 1324 * `--types` — For each path, show only its type before and after ··· 1510 1511 ###### **Options:** 1511 1512 1512 1513 * `--operation <OPERATION>` — Show repository changes in this operation, compared to its parent 1513 - * `--from <FROM>` — Show repository changes from this operation 1514 - * `--to <TO>` — Show repository changes to this operation 1514 + * `-f`, `--from <FROM>` — Show repository changes from this operation 1515 + * `-t`, `--to <TO>` — Show repository changes to this operation 1515 1516 * `--no-graph` — Don't show the graph, show a flat list of modified changes 1516 1517 * `-p`, `--patch` — Show patch of modifications to changes 1517 1518 ··· 1913 1914 1914 1915 ###### **Options:** 1915 1916 1916 - * `--from <FROM>` — Revision to restore from (source) 1917 - * `--to <TO>` — Revision to restore into (destination) 1917 + * `-f`, `--from <FROM>` — Revision to restore from (source) 1918 + * `-t`, `--to <TO>` — Revision to restore into (destination) 1918 1919 * `-c`, `--changes-in <REVISION>` — Undo the changes in a revision as compared to the merge of its parents. 1919 1920 1920 1921 This undoes the changes that can be seen with `jj diff -r REVISION`. If `REVISION` only has a single parent, this option is equivalent to `jj restore --to REVISION --from REVISION-`.
+4 -4
cli/tests/test_global_opts.rs
··· 642 642 let test_env = TestEnvironment::default(); 643 643 644 644 let stdout = test_env.jj_cmd_success(test_env.env_root(), &["diffedit", "-h"]); 645 - insta::assert_snapshot!(stdout, @r#" 645 + insta::assert_snapshot!(stdout, @r" 646 646 Touch up the content changes in a revision with a diff editor 647 647 648 648 Usage: jj diffedit [OPTIONS] 649 649 650 650 Options: 651 651 -r, --revision <REVISION> The revision to touch up 652 - --from <FROM> Show changes from this revision 653 - --to <TO> Edit changes in this revision 652 + -f, --from <FROM> Show changes from this revision 653 + -t, --to <TO> Edit changes in this revision 654 654 --tool <NAME> Specify diff editor to be used 655 655 --restore-descendants Preserve the content (not the diff) when rebasing descendants 656 656 -h, --help Print help (see more with '--help') ··· 665 665 --quiet Silence non-primary command output 666 666 --no-pager Disable the pager 667 667 --config-toml <TOML> Additional configuration options (can be repeated) 668 - "#); 668 + "); 669 669 } 670 670 671 671 #[test]