From c9706fc0d47dedeab736b69ebb4d927124e1be2a Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Sat, 17 Dec 2022 19:56:21 -0800 Subject: [PATCH] Rename `jj touchup` to `jj diffedit` --- CHANGELOG.md | 2 ++ README.md | 2 +- docs/git-comparison.md | 2 +- docs/tutorial.md | 8 ++++---- src/commands.rs | 10 +++++----- tests/test_global_opts.rs | 4 ++-- tests/test_touchup_command.rs | 18 +++++++++--------- 7 files changed, 24 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f5be7d36..6def871dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Breaking changes +* The `jj touchup` command was renamed to `jj diffedit`. + ### New features * The default log format now uses the committer timestamp instead of the author diff --git a/README.md b/README.md index 561d24beb..de2e89b89 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ updated. So will the working copy if it points to a rebased commit. ### Comprehensive support for rewriting history Besides the usual rebase command, there's `jj describe` for editing the -description (commit message) of an arbitrary commit. There's also `jj touchup`, +description (commit message) of an arbitrary commit. There's also `jj diffedit`, which lets you edit the changes in a commit without checking it out. To split a commit into two, use `jj split`. You can even move part of the changes in a commit to any other commit using `jj move`. diff --git a/docs/git-comparison.md b/docs/git-comparison.md index 4bbf8d7b1..860020a9e 100644 --- a/docs/git-comparison.md +++ b/docs/git-comparison.md @@ -245,7 +245,7 @@ parent. Interactively edit the diff in a given change - jj touchup -r <revision> + jj diffedit -r <revision> Not supported (can be emulated with the "edit" action in git rebase -i) diff --git a/docs/tutorial.md b/docs/tutorial.md index 25ed6417a..25c235137 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -377,10 +377,10 @@ the parent change, even if they touch the same word, and it won't cause any conflicts. Let's try one final command for changing the contents of an exiting commit. That -command is `jj touchup`, which lets you edit the contents of a commit without +command is `jj diffedit`, which lets you edit the contents of a commit without checking it out. ```shell script -$ jj touchup -r @- +$ jj diffedit -r @- Created 2423c134ea70 ABC Rebased 1 descendant commits Working copy now at: d31c52e8ca41 ABCD @@ -390,10 +390,10 @@ When Meld starts, edit the right side by e.g. adding something to the first line. Then close Meld. You can now inspect the rewritten commit with `jj diff -r @-` again and you should see your addition to the first line. Unlike `jj squash -i`, which left the content state of the commit unchanged, -`jj touchup` (typically) results in a different state, which means that +`jj diffedit` (typically) results in a different state, which means that descendant commits may have conflicts. Other commands for rewriting contents of existing commits are `jj restore -i`, `jj split`, `jj unsquash -i`. Now that you've seen how `jj squash -i` and -`jj touchup` work, you can hopefully figure out how those work (with the help of +`jj diffedit` work, you can hopefully figure out how those work (with the help of the instructions in the diff). diff --git a/src/commands.rs b/src/commands.rs index 4b2509ab6..6c47f4b52 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -88,7 +88,7 @@ enum Commands { Squash(SquashArgs), Unsquash(UnsquashArgs), Restore(RestoreArgs), - Touchup(TouchupArgs), + Diffedit(DiffeditArgs), Resolve(ResolveArgs), Split(SplitArgs), /// Merge work from multiple branches @@ -554,7 +554,7 @@ struct RestoreArgs { /// another. See `jj squash -i` or `jj unsquash -i` if you instead want to move /// changes into or out of the parent revision. #[derive(clap::Args, Clone, Debug)] -struct TouchupArgs { +struct DiffeditArgs { /// The revision to touch up. Defaults to @ if --to/--from are not /// specified. #[arg(long, short)] @@ -2417,10 +2417,10 @@ side. If you don't make any changes, then the operation will be aborted. Ok(()) } -fn cmd_touchup( +fn cmd_diffedit( ui: &mut Ui, command: &CommandHelper, - args: &TouchupArgs, + args: &DiffeditArgs, ) -> Result<(), CommandError> { let mut workspace_command = command.workspace_helper(ui)?; @@ -4289,7 +4289,7 @@ pub fn run_command( Commands::Squash(sub_args) => cmd_squash(ui, command_helper, sub_args), Commands::Unsquash(sub_args) => cmd_unsquash(ui, command_helper, sub_args), Commands::Restore(sub_args) => cmd_restore(ui, command_helper, sub_args), - Commands::Touchup(sub_args) => cmd_touchup(ui, command_helper, sub_args), + Commands::Diffedit(sub_args) => cmd_diffedit(ui, command_helper, sub_args), Commands::Split(sub_args) => cmd_split(ui, command_helper, sub_args), Commands::Merge(sub_args) => cmd_merge(ui, command_helper, sub_args), Commands::Rebase(sub_args) => cmd_rebase(ui, command_helper, sub_args), diff --git a/tests/test_global_opts.rs b/tests/test_global_opts.rs index 050ba9857..435948bb6 100644 --- a/tests/test_global_opts.rs +++ b/tests/test_global_opts.rs @@ -261,11 +261,11 @@ fn test_help() { // Test that global options are separated out in the help output let test_env = TestEnvironment::default(); - let stdout = test_env.jj_cmd_success(test_env.env_root(), &["touchup", "-h"]); + let stdout = test_env.jj_cmd_success(test_env.env_root(), &["diffedit", "-h"]); insta::assert_snapshot!(stdout, @r###" Touch up the content changes in a revision with a diff editor - Usage: jj touchup [OPTIONS] + Usage: jj diffedit [OPTIONS] Options: -r, --revision The revision to touch up. Defaults to @ if --to/--from are not specified diff --git a/tests/test_touchup_command.rs b/tests/test_touchup_command.rs index b20beee05..732b78a84 100644 --- a/tests/test_touchup_command.rs +++ b/tests/test_touchup_command.rs @@ -19,7 +19,7 @@ use crate::common::TestEnvironment; pub mod common; #[test] -fn test_touchup() { +fn test_diffedit() { let mut test_env = TestEnvironment::default(); test_env.jj_cmd_success(test_env.env_root(), &["init", "repo", "--git"]); let repo_path = test_env.env_root().join("repo"); @@ -40,7 +40,7 @@ fn test_touchup() { "files-before file1 file2\0files-after JJ-INSTRUCTIONS file2", ) .unwrap(); - let stdout = test_env.jj_cmd_success(&repo_path, &["touchup"]); + let stdout = test_env.jj_cmd_success(&repo_path, &["diffedit"]); insta::assert_snapshot!(stdout, @r###" Nothing changed. "###); @@ -52,7 +52,7 @@ fn test_touchup() { // Nothing happens if the diff-editor exits with an error std::fs::write(&edit_script, "rm file2\0fail").unwrap(); - let stderr = test_env.jj_cmd_failure(&repo_path, &["touchup"]); + let stderr = test_env.jj_cmd_failure(&repo_path, &["diffedit"]); insta::assert_snapshot!(Regex::new(r"Details: [^\n]+").unwrap().replace(&stderr, "Details: "), @r###" Error: Failed to edit diff: Tool exited with a non-zero code. Details: @@ -65,7 +65,7 @@ fn test_touchup() { // Can edit changes to individual files std::fs::write(&edit_script, "reset file2").unwrap(); - let stdout = test_env.jj_cmd_success(&repo_path, &["touchup"]); + let stdout = test_env.jj_cmd_success(&repo_path, &["diffedit"]); insta::assert_snapshot!(stdout, @r###" Created 1930da4a57e9 (no description set) Working copy now at: 1930da4a57e9 (no description set) @@ -79,7 +79,7 @@ fn test_touchup() { // Changes to a commit are propagated to descendants test_env.jj_cmd_success(&repo_path, &["undo"]); std::fs::write(&edit_script, "write file3\nmodified\n").unwrap(); - let stdout = test_env.jj_cmd_success(&repo_path, &["touchup", "-r", "@-"]); + let stdout = test_env.jj_cmd_success(&repo_path, &["diffedit", "-r", "@-"]); insta::assert_snapshot!(stdout, @r###" Created c03ae96780b6 (no description set) Rebased 1 descendant commits @@ -91,14 +91,14 @@ fn test_touchup() { modified "###); - // Test touchup --from @-- + // Test diffedit --from @-- test_env.jj_cmd_success(&repo_path, &["undo"]); std::fs::write( &edit_script, "files-before file1\0files-after JJ-INSTRUCTIONS file2 file3\0reset file2", ) .unwrap(); - let stdout = test_env.jj_cmd_success(&repo_path, &["touchup", "--from", "@--"]); + let stdout = test_env.jj_cmd_success(&repo_path, &["diffedit", "--from", "@--"]); insta::assert_snapshot!(stdout, @r###" Created 15f2c966d508 (no description set) Working copy now at: 15f2c966d508 (no description set) @@ -112,7 +112,7 @@ fn test_touchup() { } #[test] -fn test_touchup_merge() { +fn test_diffedit_merge() { let mut test_env = TestEnvironment::default(); test_env.jj_cmd_success(test_env.env_root(), &["init", "repo", "--git"]); let repo_path = test_env.env_root().join("repo"); @@ -147,7 +147,7 @@ fn test_touchup_merge() { "files-before file1\0files-after JJ-INSTRUCTIONS file1 file3\0rm file1", ) .unwrap(); - let stdout = test_env.jj_cmd_success(&repo_path, &["touchup", "-r", "@-"]); + let stdout = test_env.jj_cmd_success(&repo_path, &["diffedit", "-r", "@-"]); insta::assert_snapshot!(stdout, @r###" Created cb2b3b755c0a merge Rebased 1 descendant commits