forked from mirrors/jj
parent
30f5471fc3
commit
3c71ae3c76
5 changed files with 10 additions and 9 deletions
|
@ -11,7 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
* `jj rebase` now accepts a `--branch/-b <revision>` argument, which can be used
|
* `jj rebase` now accepts a `--branch/-b <revision>` argument, which can be used
|
||||||
instead of `-r` or `-s` to specify which commits to rebase. It will rebase the
|
instead of `-r` or `-s` to specify which commits to rebase. It will rebase the
|
||||||
whole branch, relative to the destination.
|
whole branch, relative to the destination. The default mode has changed from
|
||||||
|
`-r @` to `-b @`.
|
||||||
|
|
||||||
* The new `jj print` command prints the contents of a file in a revision.
|
* The new `jj print` command prints the contents of a file in a revision.
|
||||||
|
|
||||||
|
|
|
@ -1389,7 +1389,7 @@ struct MergeArgs {
|
||||||
/// There are three different ways of specifying which revisions to rebase:
|
/// There are three different ways of specifying which revisions to rebase:
|
||||||
/// `-b` to rebase a whole branch, `-s` to rebase a revision and its
|
/// `-b` to rebase a whole branch, `-s` to rebase a revision and its
|
||||||
/// descendants, and `-r` to rebase a single commit. If none if them is
|
/// descendants, and `-r` to rebase a single commit. If none if them is
|
||||||
/// specified, it defaults to `-r @`.
|
/// specified, it defaults to `-b @`.
|
||||||
///
|
///
|
||||||
/// With `-b`, it rebases the whole branch containing the specified revision.
|
/// With `-b`, it rebases the whole branch containing the specified revision.
|
||||||
/// Unlike `-s` and `-r`, the `-b` mode takes the destination into account
|
/// Unlike `-s` and `-r`, the `-b` mode takes the destination into account
|
||||||
|
@ -3635,13 +3635,13 @@ fn cmd_rebase(ui: &mut Ui, command: &CommandHelper, args: &RebaseArgs) -> Result
|
||||||
let destination = workspace_command.resolve_single_rev(ui, revision_str)?;
|
let destination = workspace_command.resolve_single_rev(ui, revision_str)?;
|
||||||
new_parents.push(destination);
|
new_parents.push(destination);
|
||||||
}
|
}
|
||||||
if let Some(branch_str) = &args.branch {
|
if let Some(rev_str) = &args.revision {
|
||||||
rebase_branch(ui, &mut workspace_command, &new_parents, branch_str)?;
|
rebase_revision(ui, &mut workspace_command, &new_parents, rev_str)?;
|
||||||
} else if let Some(source_str) = &args.source {
|
} else if let Some(source_str) = &args.source {
|
||||||
rebase_descendants(ui, &mut workspace_command, &new_parents, source_str)?;
|
rebase_descendants(ui, &mut workspace_command, &new_parents, source_str)?;
|
||||||
} else {
|
} else {
|
||||||
let rev_str = args.revision.as_deref().unwrap_or("@");
|
let branch_str = args.branch.as_deref().unwrap_or("@");
|
||||||
rebase_revision(ui, &mut workspace_command, &new_parents, rev_str)?;
|
rebase_branch(ui, &mut workspace_command, &new_parents, branch_str)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ fn test_git_push() {
|
||||||
std::fs::write(workspace_root.join("file"), "second").unwrap();
|
std::fs::write(workspace_root.join("file"), "second").unwrap();
|
||||||
test_env.jj_cmd_success(&workspace_root, &["close", "-m", "second"]);
|
test_env.jj_cmd_success(&workspace_root, &["close", "-m", "second"]);
|
||||||
std::fs::write(workspace_root.join("file"), "third").unwrap();
|
std::fs::write(workspace_root.join("file"), "third").unwrap();
|
||||||
test_env.jj_cmd_success(&workspace_root, &["rebase", "-d", "@--"]);
|
test_env.jj_cmd_success(&workspace_root, &["rebase", "-r", "@", "-d", "@--"]);
|
||||||
test_env.jj_cmd_success(&workspace_root, &["branch", "my-branch"]);
|
test_env.jj_cmd_success(&workspace_root, &["branch", "my-branch"]);
|
||||||
test_env.jj_cmd_success(&workspace_root, &["close", "-m", "third"]);
|
test_env.jj_cmd_success(&workspace_root, &["close", "-m", "third"]);
|
||||||
let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push"]);
|
let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push"]);
|
||||||
|
|
|
@ -52,7 +52,7 @@ fn test_print() {
|
||||||
// Can print a conflict
|
// Can print a conflict
|
||||||
test_env.jj_cmd_success(&repo_path, &["new"]);
|
test_env.jj_cmd_success(&repo_path, &["new"]);
|
||||||
std::fs::write(repo_path.join("file1"), "c\n").unwrap();
|
std::fs::write(repo_path.join("file1"), "c\n").unwrap();
|
||||||
test_env.jj_cmd_success(&repo_path, &["rebase", "-d", "@--"]);
|
test_env.jj_cmd_success(&repo_path, &["rebase", "-r", "@", "-d", "@--"]);
|
||||||
let stdout = test_env.jj_cmd_success(&repo_path, &["print", "file1"]);
|
let stdout = test_env.jj_cmd_success(&repo_path, &["print", "file1"]);
|
||||||
insta::assert_snapshot!(stdout, @r###"
|
insta::assert_snapshot!(stdout, @r###"
|
||||||
<<<<<<<
|
<<<<<<<
|
||||||
|
|
|
@ -159,7 +159,7 @@ fn test_rebase_branch_with_merge() {
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
test_env.jj_cmd_success(&repo_path, &["undo"]);
|
test_env.jj_cmd_success(&repo_path, &["undo"]);
|
||||||
let stdout = test_env.jj_cmd_success(&repo_path, &["rebase", "-b", "e", "-d", "b"]);
|
let stdout = test_env.jj_cmd_success(&repo_path, &["rebase", "-d", "b"]);
|
||||||
insta::assert_snapshot!(stdout, @r###"
|
insta::assert_snapshot!(stdout, @r###"
|
||||||
Rebased 4 commits
|
Rebased 4 commits
|
||||||
Working copy now at: a15dfb947f3f
|
Working copy now at: a15dfb947f3f
|
||||||
|
|
Loading…
Reference in a new issue