mirror of
https://github.com/martinvonz/jj.git
synced 2024-09-11 05:45:30 +03:00
move: deprecate the command
Per discussion in https://github.com/martinvonz/jj/discussions/2882. `jj squash` now has all the functionality.
This commit is contained in:
parent
e6ef217d90
commit
e9655dba13
@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Deprecations
|
### Deprecations
|
||||||
|
|
||||||
|
* `jj move` was deprecated in favor of `jj squash`.
|
||||||
|
|
||||||
### Breaking changes
|
### Breaking changes
|
||||||
|
|
||||||
### New features
|
### New features
|
||||||
|
@ -276,7 +276,7 @@ Besides the usual rebase command, there's `jj describe` for editing the
|
|||||||
description (commit message) of an arbitrary commit. There's also `jj diffedit`,
|
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
|
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
|
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`.
|
commit to any other commit using `jj squash -i --from X --into Y`.
|
||||||
|
|
||||||
## Status
|
## Status
|
||||||
|
|
||||||
|
@ -62,6 +62,14 @@ pub(crate) fn cmd_move(
|
|||||||
command: &CommandHelper,
|
command: &CommandHelper,
|
||||||
args: &MoveArgs,
|
args: &MoveArgs,
|
||||||
) -> Result<(), CommandError> {
|
) -> Result<(), CommandError> {
|
||||||
|
writeln!(
|
||||||
|
ui.warning(),
|
||||||
|
"warning: `jj move` is deprecated; use `jj squash` instead, which is equivalent"
|
||||||
|
)?;
|
||||||
|
writeln!(
|
||||||
|
ui.warning(),
|
||||||
|
"warning: `jj move` will be removed in a future version, and this will be a hard error"
|
||||||
|
)?;
|
||||||
let mut workspace_command = command.workspace_helper(ui)?;
|
let mut workspace_command = command.workspace_helper(ui)?;
|
||||||
let source = workspace_command.resolve_single_rev(args.from.as_deref().unwrap_or("@"))?;
|
let source = workspace_command.resolve_single_rev(args.from.as_deref().unwrap_or("@"))?;
|
||||||
let destination = workspace_command.resolve_single_rev(args.to.as_deref().unwrap_or("@"))?;
|
let destination = workspace_command.resolve_single_rev(args.to.as_deref().unwrap_or("@"))?;
|
||||||
|
@ -143,12 +143,16 @@ fn test_rewrite_immutable_commands() {
|
|||||||
// move --from
|
// move --from
|
||||||
let stderr = test_env.jj_cmd_failure(&repo_path, &["move", "--from=main"]);
|
let stderr = test_env.jj_cmd_failure(&repo_path, &["move", "--from=main"]);
|
||||||
insta::assert_snapshot!(stderr, @r###"
|
insta::assert_snapshot!(stderr, @r###"
|
||||||
|
warning: `jj move` is deprecated; use `jj squash` instead, which is equivalent
|
||||||
|
warning: `jj move` will be removed in a future version, and this will be a hard error
|
||||||
Error: Commit 3d14df18607e is immutable
|
Error: Commit 3d14df18607e is immutable
|
||||||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
|
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
|
||||||
"###);
|
"###);
|
||||||
// move --to
|
// move --to
|
||||||
let stderr = test_env.jj_cmd_failure(&repo_path, &["move", "--to=main"]);
|
let stderr = test_env.jj_cmd_failure(&repo_path, &["move", "--to=main"]);
|
||||||
insta::assert_snapshot!(stderr, @r###"
|
insta::assert_snapshot!(stderr, @r###"
|
||||||
|
warning: `jj move` is deprecated; use `jj squash` instead, which is equivalent
|
||||||
|
warning: `jj move` will be removed in a future version, and this will be a hard error
|
||||||
Error: Commit 3d14df18607e is immutable
|
Error: Commit 3d14df18607e is immutable
|
||||||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
|
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
|
||||||
"###);
|
"###);
|
||||||
|
@ -78,6 +78,8 @@ fn test_move() {
|
|||||||
// Errors out if source and destination are the same
|
// Errors out if source and destination are the same
|
||||||
let stderr = test_env.jj_cmd_failure(&repo_path, &["move", "--to", "@"]);
|
let stderr = test_env.jj_cmd_failure(&repo_path, &["move", "--to", "@"]);
|
||||||
insta::assert_snapshot!(stderr, @r###"
|
insta::assert_snapshot!(stderr, @r###"
|
||||||
|
warning: `jj move` is deprecated; use `jj squash` instead, which is equivalent
|
||||||
|
warning: `jj move` will be removed in a future version, and this will be a hard error
|
||||||
Error: Source and destination cannot be the same.
|
Error: Source and destination cannot be the same.
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
@ -85,6 +87,8 @@ fn test_move() {
|
|||||||
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["move", "--from", "c"]);
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["move", "--from", "c"]);
|
||||||
insta::assert_snapshot!(stdout, @"");
|
insta::assert_snapshot!(stdout, @"");
|
||||||
insta::assert_snapshot!(stderr, @r###"
|
insta::assert_snapshot!(stderr, @r###"
|
||||||
|
warning: `jj move` is deprecated; use `jj squash` instead, which is equivalent
|
||||||
|
warning: `jj move` will be removed in a future version, and this will be a hard error
|
||||||
Working copy now at: kmkuslsw 1c03e3d3 f | (no description set)
|
Working copy now at: kmkuslsw 1c03e3d3 f | (no description set)
|
||||||
Parent commit : znkkpsqq e9515f21 e | (no description set)
|
Parent commit : znkkpsqq e9515f21 e | (no description set)
|
||||||
Added 0 files, modified 1 files, removed 0 files
|
Added 0 files, modified 1 files, removed 0 files
|
||||||
@ -114,6 +118,8 @@ fn test_move() {
|
|||||||
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["move", "--from", "@--"]);
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["move", "--from", "@--"]);
|
||||||
insta::assert_snapshot!(stdout, @"");
|
insta::assert_snapshot!(stdout, @"");
|
||||||
insta::assert_snapshot!(stderr, @r###"
|
insta::assert_snapshot!(stderr, @r###"
|
||||||
|
warning: `jj move` is deprecated; use `jj squash` instead, which is equivalent
|
||||||
|
warning: `jj move` will be removed in a future version, and this will be a hard error
|
||||||
Working copy now at: kmkuslsw c8d83075 f | (no description set)
|
Working copy now at: kmkuslsw c8d83075 f | (no description set)
|
||||||
Parent commit : znkkpsqq 2c50bfc5 e | (no description set)
|
Parent commit : znkkpsqq 2c50bfc5 e | (no description set)
|
||||||
"###);
|
"###);
|
||||||
@ -140,6 +146,8 @@ fn test_move() {
|
|||||||
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["move", "--from", "e", "--to", "d"]);
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["move", "--from", "e", "--to", "d"]);
|
||||||
insta::assert_snapshot!(stdout, @"");
|
insta::assert_snapshot!(stdout, @"");
|
||||||
insta::assert_snapshot!(stderr, @r###"
|
insta::assert_snapshot!(stderr, @r###"
|
||||||
|
warning: `jj move` is deprecated; use `jj squash` instead, which is equivalent
|
||||||
|
warning: `jj move` will be removed in a future version, and this will be a hard error
|
||||||
Rebased 1 descendant commits
|
Rebased 1 descendant commits
|
||||||
Working copy now at: kmkuslsw 2b723b1d f | (no description set)
|
Working copy now at: kmkuslsw 2b723b1d f | (no description set)
|
||||||
Parent commit : vruxwmqv 4293930d d e | (no description set)
|
Parent commit : vruxwmqv 4293930d d e | (no description set)
|
||||||
@ -205,6 +213,8 @@ fn test_move_partial() {
|
|||||||
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["move", "-i", "--from", "c"]);
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["move", "-i", "--from", "c"]);
|
||||||
insta::assert_snapshot!(stdout, @"");
|
insta::assert_snapshot!(stdout, @"");
|
||||||
insta::assert_snapshot!(stderr, @r###"
|
insta::assert_snapshot!(stderr, @r###"
|
||||||
|
warning: `jj move` is deprecated; use `jj squash` instead, which is equivalent
|
||||||
|
warning: `jj move` will be removed in a future version, and this will be a hard error
|
||||||
Working copy now at: vruxwmqv 71b69e43 d | (no description set)
|
Working copy now at: vruxwmqv 71b69e43 d | (no description set)
|
||||||
Parent commit : qpvuntsm 3db0a2f5 a | (no description set)
|
Parent commit : qpvuntsm 3db0a2f5 a | (no description set)
|
||||||
Added 0 files, modified 2 files, removed 0 files
|
Added 0 files, modified 2 files, removed 0 files
|
||||||
@ -237,6 +247,8 @@ fn test_move_partial() {
|
|||||||
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["move", "-i", "--from", "c"]);
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["move", "-i", "--from", "c"]);
|
||||||
insta::assert_snapshot!(stdout, @"");
|
insta::assert_snapshot!(stdout, @"");
|
||||||
insta::assert_snapshot!(stderr, @r###"
|
insta::assert_snapshot!(stderr, @r###"
|
||||||
|
warning: `jj move` is deprecated; use `jj squash` instead, which is equivalent
|
||||||
|
warning: `jj move` will be removed in a future version, and this will be a hard error
|
||||||
Working copy now at: vruxwmqv 63f1a6e9 d | (no description set)
|
Working copy now at: vruxwmqv 63f1a6e9 d | (no description set)
|
||||||
Parent commit : qpvuntsm 3db0a2f5 a | (no description set)
|
Parent commit : qpvuntsm 3db0a2f5 a | (no description set)
|
||||||
Added 0 files, modified 1 files, removed 0 files
|
Added 0 files, modified 1 files, removed 0 files
|
||||||
@ -272,6 +284,8 @@ fn test_move_partial() {
|
|||||||
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["move", "--from", "c", "file1"]);
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["move", "--from", "c", "file1"]);
|
||||||
insta::assert_snapshot!(stdout, @"");
|
insta::assert_snapshot!(stdout, @"");
|
||||||
insta::assert_snapshot!(stderr, @r###"
|
insta::assert_snapshot!(stderr, @r###"
|
||||||
|
warning: `jj move` is deprecated; use `jj squash` instead, which is equivalent
|
||||||
|
warning: `jj move` will be removed in a future version, and this will be a hard error
|
||||||
Working copy now at: vruxwmqv 17c2e663 d | (no description set)
|
Working copy now at: vruxwmqv 17c2e663 d | (no description set)
|
||||||
Parent commit : qpvuntsm 3db0a2f5 a | (no description set)
|
Parent commit : qpvuntsm 3db0a2f5 a | (no description set)
|
||||||
Added 0 files, modified 1 files, removed 0 files
|
Added 0 files, modified 1 files, removed 0 files
|
||||||
@ -308,6 +322,8 @@ fn test_move_partial() {
|
|||||||
test_env.jj_cmd_ok(&repo_path, &["move", "--from", "c", "--to", "b", "file1"]);
|
test_env.jj_cmd_ok(&repo_path, &["move", "--from", "c", "--to", "b", "file1"]);
|
||||||
insta::assert_snapshot!(stdout, @"");
|
insta::assert_snapshot!(stdout, @"");
|
||||||
insta::assert_snapshot!(stderr, @r###"
|
insta::assert_snapshot!(stderr, @r###"
|
||||||
|
warning: `jj move` is deprecated; use `jj squash` instead, which is equivalent
|
||||||
|
warning: `jj move` will be removed in a future version, and this will be a hard error
|
||||||
Rebased 1 descendant commits
|
Rebased 1 descendant commits
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||||
@ -335,6 +351,8 @@ fn test_move_partial() {
|
|||||||
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["move", "--from", "c", "nonexistent"]);
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["move", "--from", "c", "nonexistent"]);
|
||||||
insta::assert_snapshot!(stdout, @"");
|
insta::assert_snapshot!(stdout, @"");
|
||||||
insta::assert_snapshot!(stderr, @r###"
|
insta::assert_snapshot!(stderr, @r###"
|
||||||
|
warning: `jj move` is deprecated; use `jj squash` instead, which is equivalent
|
||||||
|
warning: `jj move` will be removed in a future version, and this will be a hard error
|
||||||
Working copy now at: vruxwmqv b670567d d | (no description set)
|
Working copy now at: vruxwmqv b670567d d | (no description set)
|
||||||
Parent commit : qpvuntsm 3db0a2f5 a | (no description set)
|
Parent commit : qpvuntsm 3db0a2f5 a | (no description set)
|
||||||
"###);
|
"###);
|
||||||
|
@ -122,9 +122,8 @@ try `jj rebase -s all:commit_with_local_changes+ -d main`
|
|||||||
|
|
||||||
An alternative workflow would be to rebase the commit with local changes on
|
An alternative workflow would be to rebase the commit with local changes on
|
||||||
top of the PR you're working on and then do `jj new commit_with_local_changes`.
|
top of the PR you're working on and then do `jj new commit_with_local_changes`.
|
||||||
You'll then need to use `jj new --before` to create new commits
|
You'll then need to use `jj new --before` to create new commits and
|
||||||
and `jj move --to`
|
`jj squash --into` to move new changes into the correct commits.
|
||||||
to move new changes into the correct commits.
|
|
||||||
|
|
||||||
### I accidentally changed files in the wrong commit, how do I move the recent changes into another commit?
|
### I accidentally changed files in the wrong commit, how do I move the recent changes into another commit?
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ parent.
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Abandon the parent of the working copy, but keep its diff in the working copy</td>
|
<td>Abandon the parent of the working copy, but keep its diff in the working copy</td>
|
||||||
<td><code>jj move --from @-</code></td>
|
<td><code>jj squash --from @-</code></td>
|
||||||
<td><code>git reset --soft HEAD~</code></td>
|
<td><code>git reset --soft HEAD~</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -275,13 +275,13 @@ parent.
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Move the diff in the working copy into an ancestor</td>
|
<td>Move the diff in the working copy into an ancestor</td>
|
||||||
<td><code>jj move --to X</code></td>
|
<td><code>jj squash --into X</code></td>
|
||||||
<td><code>git commit --fixup=X; git rebase -i --autosquash X^</code></td>
|
<td><code>git commit --fixup=X; git rebase -i --autosquash X^</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Interactively move part of the diff in an arbitrary change to another
|
<td>Interactively move part of the diff in an arbitrary change to another
|
||||||
arbitrary change</td>
|
arbitrary change</td>
|
||||||
<td><code>jj move -i --from X --to Y</code></td>
|
<td><code>jj squash -i --from X --into Y</code></td>
|
||||||
<td>Not supported</td>
|
<td>Not supported</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -486,6 +486,6 @@ unchanged, `jj diffedit` (typically) results in a different state, which means
|
|||||||
that descendant commits may have conflicts.
|
that descendant commits may have conflicts.
|
||||||
|
|
||||||
Other commands for rewriting contents of existing commits are `jj split`, `jj
|
Other commands for rewriting contents of existing commits are `jj split`, `jj
|
||||||
unsquash -i` and `jj move -i`. Now that you've seen how `jj squash -i` and `jj
|
unsquash -i`. Now that you've seen how `jj squash -i` and `jj diffedit` work,
|
||||||
diffedit` work, you can hopefully figure out how those work (with the help of
|
you can hopefully figure out how those work (with the help of the instructions
|
||||||
the instructions in the diff).
|
in the diff).
|
||||||
|
Loading…
Reference in New Issue
Block a user