mirror of
https://github.com/martinvonz/jj.git
synced 2025-05-17 21:24:26 +00:00
Make jj abandon
print each abandoned commit once
This commit is contained in:
parent
7057ce2183
commit
3e7791bbc1
@ -2038,8 +2038,8 @@ fn cmd_commit(ui: &mut Ui, command: &CommandHelper, args: &CommitArgs) -> Result
|
|||||||
fn resolve_multiple_rewriteable_revsets(
|
fn resolve_multiple_rewriteable_revsets(
|
||||||
revision_args: &[RevisionArg],
|
revision_args: &[RevisionArg],
|
||||||
workspace_command: &WorkspaceCommandHelper,
|
workspace_command: &WorkspaceCommandHelper,
|
||||||
) -> Result<Vec<Commit>, CommandError> {
|
) -> Result<IndexSet<Commit>, CommandError> {
|
||||||
let mut acc = Vec::new();
|
let mut acc = IndexSet::new();
|
||||||
for revset in revision_args {
|
for revset in revision_args {
|
||||||
let revisions = workspace_command.resolve_revset(revset)?;
|
let revisions = workspace_command.resolve_revset(revset)?;
|
||||||
workspace_command.check_non_empty(&revisions)?;
|
workspace_command.check_non_empty(&revisions)?;
|
||||||
@ -2058,9 +2058,7 @@ fn cmd_duplicate(
|
|||||||
) -> Result<(), CommandError> {
|
) -> Result<(), CommandError> {
|
||||||
let mut workspace_command = command.workspace_helper(ui)?;
|
let mut workspace_command = command.workspace_helper(ui)?;
|
||||||
let to_duplicate: IndexSet<Commit> =
|
let to_duplicate: IndexSet<Commit> =
|
||||||
resolve_multiple_rewriteable_revsets(&args.revisions, &workspace_command)?
|
resolve_multiple_rewriteable_revsets(&args.revisions, &workspace_command)?;
|
||||||
.into_iter()
|
|
||||||
.collect();
|
|
||||||
let mut duplicated_old_to_new: IndexMap<Commit, Commit> = IndexMap::new();
|
let mut duplicated_old_to_new: IndexMap<Commit, Commit> = IndexMap::new();
|
||||||
|
|
||||||
let mut tx = workspace_command
|
let mut tx = workspace_command
|
||||||
|
@ -112,11 +112,8 @@ fn test_rebase_branch_with_merge() {
|
|||||||
// Test abandoning the same commit twice directly
|
// Test abandoning the same commit twice directly
|
||||||
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, &["abandon", "b", "b"]);
|
let stdout = test_env.jj_cmd_success(&repo_path, &["abandon", "b", "b"]);
|
||||||
// Note that the same commit is listed twice
|
|
||||||
insta::assert_snapshot!(stdout, @r###"
|
insta::assert_snapshot!(stdout, @r###"
|
||||||
Abandoned the following commits:
|
Abandoned commit 1394f625cbbd b
|
||||||
1394f625cbbd b
|
|
||||||
1394f625cbbd b
|
|
||||||
"###);
|
"###);
|
||||||
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||||
@ e
|
@ e
|
||||||
@ -131,12 +128,10 @@ fn test_rebase_branch_with_merge() {
|
|||||||
// Test abandoning the same commit twice indirectly
|
// Test abandoning the same commit twice indirectly
|
||||||
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, &["abandon", "d:", "a:"]);
|
let stdout = test_env.jj_cmd_success(&repo_path, &["abandon", "d:", "a:"]);
|
||||||
// Note that the same commit is listed twice
|
|
||||||
insta::assert_snapshot!(stdout, @r###"
|
insta::assert_snapshot!(stdout, @r###"
|
||||||
Abandoned the following commits:
|
Abandoned the following commits:
|
||||||
5557ece3e631 e
|
5557ece3e631 e
|
||||||
b7c62f28ed10 d
|
b7c62f28ed10 d
|
||||||
5557ece3e631 e
|
|
||||||
1394f625cbbd b
|
1394f625cbbd b
|
||||||
2443ea76b0b1 a
|
2443ea76b0b1 a
|
||||||
Working copy now at: af874bffee6e (no description set)
|
Working copy now at: af874bffee6e (no description set)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user