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