ok/jj
1
0
Fork 0
forked from mirrors/jj

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:
Martin von Zweigbergk 2024-03-10 21:24:13 -07:00 committed by Martin von Zweigbergk
parent e6ef217d90
commit e9655dba13
8 changed files with 41 additions and 10 deletions

View file

@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Deprecations
* `jj move` was deprecated in favor of `jj squash`.
### Breaking changes
### New features

View file

@ -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`,
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`.
commit to any other commit using `jj squash -i --from X --into Y`.
## Status

View file

@ -62,6 +62,14 @@ pub(crate) fn cmd_move(
command: &CommandHelper,
args: &MoveArgs,
) -> 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 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("@"))?;

View file

@ -143,12 +143,16 @@ fn test_rewrite_immutable_commands() {
// move --from
let stderr = test_env.jj_cmd_failure(&repo_path, &["move", "--from=main"]);
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
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// move --to
let stderr = test_env.jj_cmd_failure(&repo_path, &["move", "--to=main"]);
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
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);

View file

@ -78,6 +78,8 @@ fn test_move() {
// Errors out if source and destination are the same
let stderr = test_env.jj_cmd_failure(&repo_path, &["move", "--to", "@"]);
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.
"###);
@ -85,6 +87,8 @@ fn test_move() {
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["move", "--from", "c"]);
insta::assert_snapshot!(stdout, @"");
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)
Parent commit : znkkpsqq e9515f21 e | (no description set)
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", "@--"]);
insta::assert_snapshot!(stdout, @"");
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)
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"]);
insta::assert_snapshot!(stdout, @"");
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
Working copy now at: kmkuslsw 2b723b1d f | (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"]);
insta::assert_snapshot!(stdout, @"");
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)
Parent commit : qpvuntsm 3db0a2f5 a | (no description set)
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"]);
insta::assert_snapshot!(stdout, @"");
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)
Parent commit : qpvuntsm 3db0a2f5 a | (no description set)
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"]);
insta::assert_snapshot!(stdout, @"");
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)
Parent commit : qpvuntsm 3db0a2f5 a | (no description set)
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"]);
insta::assert_snapshot!(stdout, @"");
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
"###);
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"]);
insta::assert_snapshot!(stdout, @"");
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)
Parent commit : qpvuntsm 3db0a2f5 a | (no description set)
"###);

View file

@ -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
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
and `jj move --to`
to move new changes into the correct commits.
You'll then need to use `jj new --before` to create new commits and
`jj squash --into` 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?

View file

@ -212,7 +212,7 @@ parent.
</tr>
<tr>
<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>
</tr>
<tr>
@ -275,13 +275,13 @@ parent.
</tr>
<tr>
<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>
</tr>
<tr>
<td>Interactively move part of the diff in an arbitrary change to another
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>
</tr>
<tr>

View file

@ -486,6 +486,6 @@ unchanged, `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 split`, `jj
unsquash -i` and `jj move -i`. Now that you've seen how `jj squash -i` and `jj
diffedit` work, you can hopefully figure out how those work (with the help of
the instructions in the diff).
unsquash -i`. Now that you've seen how `jj squash -i` and `jj diffedit` work,
you can hopefully figure out how those work (with the help of the instructions
in the diff).