Skip to content

Commit

Permalink
cli: deprecate jj merge
Browse files Browse the repository at this point in the history
Summary: As discussed in Discord, on GitHub, and elsewhere, this change
deprecates the use of `jj merge` and suggests users use `jj new` exclusively
instead. `merge` isn't completely unfit as a name; but we think it obscures
the generality of `new` and we want people to use it instead.

To further drive the bit home, by default, `jj merge` is now hidden. This will
hopefully stop new users from running into it.

Signed-off-by: Austin Seipp <[email protected]>
Change-Id: I94938aca9d3e2aa12d1394a5fbc58acce3185b56
  • Loading branch information
thoughtpolice committed Feb 3, 2024
1 parent f59ff70 commit 3758b0e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 48 deletions.
8 changes: 8 additions & 0 deletions cli/src/commands/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ pub(crate) fn cmd_merge(
command: &CommandHelper,
args: &new::NewArgs,
) -> Result<(), CommandError> {
writeln!(
ui.warning(),
"warning: `jj merge` is deprecated; use `jj new` instead, which is equivalent"
)?;
writeln!(
ui.warning(),
"warning: `jj merge` will be removed in a future version, and this will be a hard error"
)?;
if args.revisions.len() < 2 {
return Err(CommandError::CliError(String::from(
"Merge requires at least two revisions",
Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ enum Command {
///
/// This is the same as `jj new`, except that it requires at least two
/// arguments.
#[command(hide = true)]
Merge(new::NewArgs),
Move(r#move::MoveArgs),
New(new::NewArgs),
Expand Down
48 changes: 0 additions & 48 deletions cli/tests/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ This document contains the help content for the `jj` command-line program.
* [`jj init`↴](#jj-init)
* [`jj interdiff`↴](#jj-interdiff)
* [`jj log`↴](#jj-log)
* [`jj merge`↴](#jj-merge)
* [`jj move`↴](#jj-move)
* [`jj new`↴](#jj-new)
* [`jj next`↴](#jj-next)
Expand Down Expand Up @@ -117,7 +116,6 @@ To get started, see the tutorial at https://github.com/martinvonz/jj/blob/main/d
* `init`Create a new repo in the given directory
* `interdiff`Compare the changes of two commits
* `log`Show commit history
* `merge`Merge work from multiple branches
* `move`Move changes from one revision into another
* `new`Create a new, empty change and (by default) edit it in the working copy
* `next`Move the current working copy commit to the next child revision in the
Expand Down Expand Up @@ -1012,52 +1010,6 @@ Show commit history
## `jj merge`
Merge work from multiple branches
Unlike most other VCSs, `jj merge` does not implicitly include the working copy revision's parent as one of the parents of the merge; you need to explicitly list all revisions that should become parents of the merge.
This is the same as `jj new`, except that it requires at least two arguments.
**Usage:** `jj merge [OPTIONS] [REVISIONS]...`
###### **Arguments:**
* `<REVISIONS>` — Parent(s) of the new change
Default value: `@`
###### **Options:**
* `-r` — Ignored (but lets you pass `-r` for consistency with other commands)
Possible values: `true`, `false`
* `-m`, `--message <MESSAGE>` — The change description to use
* `-L`, `--allow-large-revsets` — Deprecated. Please prefix the revset with `all:` instead
Possible values: `true`, `false`
* `--no-edit` — Do not edit the newly created change
Possible values: `true`, `false`
* `--edit` — No-op flag to pair with --no-edit
Possible values: `true`, `false`
* `-A`, `--insert-after` — Insert the new change between the target commit(s) and their children
Possible values: `true`, `false`
* `-B`, `--insert-before` — Insert the new change between the target commit(s) and their parents
Possible values: `true`, `false`
## `jj move`
Move changes from one revision into another
Expand Down
4 changes: 4 additions & 0 deletions cli/tests/test_new_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,14 @@ fn test_new_merge() {
// `jj merge` with less than two arguments is an error
let stderr = test_env.jj_cmd_cli_error(&repo_path, &["merge"]);
insta::assert_snapshot!(stderr, @r###"
warning: `jj merge` is deprecated; use `jj new` instead, which is equivalent
warning: `jj merge` will be removed in a future version, and this will be a hard error
Error: Merge requires at least two revisions
"###);
let stderr = test_env.jj_cmd_cli_error(&repo_path, &["merge", "main"]);
insta::assert_snapshot!(stderr, @r###"
warning: `jj merge` is deprecated; use `jj new` instead, which is equivalent
warning: `jj merge` will be removed in a future version, and this will be a hard error
Error: Merge requires at least two revisions
"###);

Expand Down

0 comments on commit 3758b0e

Please sign in to comment.