mirror of
https://github.com/martinvonz/jj.git
synced 2024-10-05 18:08:26 +03:00
cli: deprecate jj split --siblings
in favor of jj split --parallel
This better matches `jj parallelize`.
This commit is contained in:
parent
72438fc9d2
commit
a9953b3fb0
@ -23,6 +23,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
* Replacing `-l` shorthand for `--limit` with `-n` in `jj log`, `jj op log` and `jj obslog`.
|
||||
|
||||
* `jj split --siblings` is deprecated in favor of `jj split --parallel` (to
|
||||
match `jj parallelize`).
|
||||
|
||||
### New features
|
||||
|
||||
* Show paths to config files when configuration errors occur
|
||||
|
@ -51,9 +51,11 @@ pub(crate) struct SplitArgs {
|
||||
/// The revision to split
|
||||
#[arg(long, short, default_value = "@")]
|
||||
revision: RevisionArg,
|
||||
/// Split the revision into two siblings instead of a parent and child.
|
||||
#[arg(long, short)]
|
||||
siblings: bool,
|
||||
/// Split the revision into two parallel revisions instead of a parent and
|
||||
/// child.
|
||||
// TODO: Delete `--siblings` alias in jj 0.25+
|
||||
#[arg(long, short, alias = "siblings")]
|
||||
parallel: bool,
|
||||
/// Put these paths in the first commit
|
||||
#[arg(value_hint = clap::ValueHint::AnyPath)]
|
||||
paths: Vec<String>,
|
||||
@ -137,7 +139,7 @@ the operation will be aborted.
|
||||
|
||||
// Create the second commit, which includes everything the user didn't
|
||||
// select.
|
||||
let (second_tree, second_base_tree) = if args.siblings {
|
||||
let (second_tree, second_base_tree) = if args.parallel {
|
||||
// Merge the original commit tree with its parent using the tree
|
||||
// containing the user selected changes as the base for the merge.
|
||||
// This results in a tree with the changes the user didn't select.
|
||||
@ -145,7 +147,7 @@ the operation will be aborted.
|
||||
} else {
|
||||
(end_tree, &selected_tree)
|
||||
};
|
||||
let second_commit_parents = if args.siblings {
|
||||
let second_commit_parents = if args.parallel {
|
||||
commit.parent_ids().to_vec()
|
||||
} else {
|
||||
vec![first_commit.id().clone()]
|
||||
@ -189,11 +191,11 @@ the operation will be aborted.
|
||||
vec![commit.id().clone()],
|
||||
|mut rewriter| {
|
||||
num_rebased += 1;
|
||||
if args.siblings {
|
||||
if args.parallel {
|
||||
rewriter
|
||||
.replace_parent(second_commit.id(), [first_commit.id(), second_commit.id()]);
|
||||
}
|
||||
// We don't need to do anything special for the non-siblings case
|
||||
// We don't need to do anything special for the non-parallel case
|
||||
// since we already marked the original commit as rewritten.
|
||||
rewriter.rebase(command.settings())?.write()?;
|
||||
Ok(())
|
||||
|
@ -1771,7 +1771,7 @@ Splitting an empty commit is not supported because the same effect can be achiev
|
||||
* `-r`, `--revision <REVISION>` — The revision to split
|
||||
|
||||
Default value: `@`
|
||||
* `-s`, `--siblings` — Split the revision into two siblings instead of a parent and child
|
||||
* `-p`, `--parallel` — Split the revision into two parallel revisions instead of a parent and child
|
||||
|
||||
Possible values: `true`, `false`
|
||||
|
||||
|
@ -343,7 +343,7 @@ fn test_split_siblings_no_descendants() {
|
||||
["dump editor1", "next invocation\n", "dump editor2"].join("\0"),
|
||||
)
|
||||
.unwrap();
|
||||
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_path, &["split", "--siblings", "file1"]);
|
||||
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_path, &["split", "--parallel", "file1"]);
|
||||
insta::assert_snapshot!(stdout, @"");
|
||||
insta::assert_snapshot!(stderr, @r###"
|
||||
First part: qpvuntsm 8d2b7558 TESTED=TODO
|
||||
@ -421,7 +421,7 @@ fn test_split_siblings_with_descendants() {
|
||||
.join("\0"),
|
||||
)
|
||||
.unwrap();
|
||||
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_path, &["split", "--siblings", "file1"]);
|
||||
let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_path, &["split", "--parallel", "file1"]);
|
||||
insta::assert_snapshot!(stdout, @"");
|
||||
insta::assert_snapshot!(stderr, @r###"
|
||||
Rebased 2 descendant commits
|
||||
@ -500,7 +500,7 @@ fn test_split_siblings_with_merge_child() {
|
||||
.unwrap();
|
||||
let (stdout, stderr) = test_env.jj_cmd_ok(
|
||||
&workspace_path,
|
||||
&["split", "-r", "description(a)", "--siblings", "file1"],
|
||||
&["split", "-r", "description(a)", "--parallel", "file1"],
|
||||
);
|
||||
insta::assert_snapshot!(stdout, @"");
|
||||
insta::assert_snapshot!(stderr, @r###"
|
||||
|
Loading…
Reference in New Issue
Block a user