mirror of
https://github.com/martinvonz/jj.git
synced 2024-09-11 05:45:30 +03:00
Rename jj touchup
to jj diffedit
This commit is contained in:
parent
f71ca25ebe
commit
c9706fc0d4
@ -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
|
||||
|
@ -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`.
|
||||
|
@ -245,7 +245,7 @@ parent.
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Interactively edit the diff in a given change</td>
|
||||
<td><code>jj touchup -r <revision></code></td>
|
||||
<td><code>jj diffedit -r <revision></code></td>
|
||||
<td>Not supported (can be emulated with the "edit" action in
|
||||
<code>git rebase -i</code>)</td>
|
||||
</tr>
|
||||
|
@ -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).
|
||||
|
@ -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),
|
||||
|
@ -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 <REVISION> The revision to touch up. Defaults to @ if --to/--from are not specified
|
||||
|
@ -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: <OS-Dependent>"), @r###"
|
||||
Error: Failed to edit diff: Tool exited with a non-zero code.
|
||||
Details: <OS-Dependent>
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user