2023-01-16 19:22:10 +00:00
|
|
|
// Copyright 2023 The Jujutsu Authors
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// https://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
use std::path::Path;
|
|
|
|
|
|
|
|
use crate::common::TestEnvironment;
|
|
|
|
|
|
|
|
fn create_commit(test_env: &TestEnvironment, repo_path: &Path, name: &str, parents: &[&str]) {
|
|
|
|
if parents.is_empty() {
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(repo_path, &["new", "root()", "-m", name]);
|
2023-01-16 19:22:10 +00:00
|
|
|
} else {
|
|
|
|
let mut args = vec!["new", "-m", name];
|
|
|
|
args.extend(parents);
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(repo_path, &args);
|
2023-01-16 19:22:10 +00:00
|
|
|
}
|
|
|
|
std::fs::write(repo_path.join(name), format!("{name}\n")).unwrap();
|
2024-08-21 19:59:15 +00:00
|
|
|
test_env.jj_cmd_ok(repo_path, &["bookmark", "create", name]);
|
2023-01-16 19:22:10 +00:00
|
|
|
}
|
|
|
|
|
2023-01-15 05:59:31 +00:00
|
|
|
#[test]
|
|
|
|
fn test_duplicate() {
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2023-01-15 05:59:31 +00:00
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
create_commit(&test_env, &repo_path, "a", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "b", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "c", &["a", "b"]);
|
|
|
|
// Test the setup
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
@ 17a00fc21654 c
|
|
|
|
├─╮
|
2024-07-15 22:20:10 +00:00
|
|
|
│ ○ d370aee184ba b
|
|
|
|
○ │ 2443ea76b0b1 a
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
◆ 000000000000
|
2023-01-15 05:59:31 +00:00
|
|
|
"###);
|
|
|
|
|
2024-03-15 08:35:52 +00:00
|
|
|
let stderr = test_env.jj_cmd_failure(&repo_path, &["duplicate", "all()"]);
|
2023-01-15 06:35:56 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2023-09-03 21:00:25 +00:00
|
|
|
Error: Cannot duplicate the root commit
|
2023-01-15 06:35:56 +00:00
|
|
|
"###);
|
2023-01-15 05:59:31 +00:00
|
|
|
|
2024-03-17 03:12:40 +00:00
|
|
|
let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "none()"]);
|
2024-03-15 08:35:52 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2024-03-17 03:12:40 +00:00
|
|
|
No revisions to duplicate.
|
2024-03-15 08:35:52 +00:00
|
|
|
"###);
|
|
|
|
|
2023-10-10 11:59:18 +00:00
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a"]);
|
2023-10-10 11:07:06 +00:00
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2024-03-15 08:35:52 +00:00
|
|
|
Duplicated 2443ea76b0b1 as kpqxywon f5b1e687 a
|
2023-01-15 05:59:31 +00:00
|
|
|
"###);
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#"
|
|
|
|
@ 17a00fc21654 c
|
|
|
|
├─╮
|
|
|
|
│ ○ d370aee184ba b
|
|
|
|
○ │ 2443ea76b0b1 a
|
|
|
|
├─╯
|
|
|
|
│ ○ f5b1e68729d6 a
|
revset_graph: group commits topologically
The original idea was similar to Mercurial's "topo" sorting, but it was bad
at handling merge-heavy history. In order to render merges of topic branches
nicely, we need to prioritize branches at merge point, not at fork point.
OTOH, we do also want to place unmerged branches as close to the fork point
as possible. This commit implements the former requirement, and the latter
will be addressed by the next commit.
I think this is similar to Git's sorting logic described in the following blog
post. In our case, the in-degree walk can be dumb since topological order is
guaranteed by the index. We keep HashSet<CommitId> instead of an in-degree
integer value, which will be used in the next commit to resolve new heads as
late as possible.
https://github.blog/2022-08-30-gits-database-internals-ii-commit-history-queries/#topological-sorting
Compared to Sapling's beautify_graph(), this is lazy, and can roughly preserve
the index (or chronological) order. I tried beautify_graph() with prioritizing
the @ commit, but the result seemed too aggressively reordered. Perhaps, for
more complex history, beautify_graph() would produce a better result. For my
wip branches (~30 branches, a couple of commits per branch), this works pretty
well.
#242
2023-07-16 10:47:46 +00:00
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
"#);
|
2023-01-15 05:59:31 +00:00
|
|
|
|
2023-10-10 11:59:18 +00:00
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-09-12 14:20:57 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r#"
|
2024-10-07 03:00:49 +00:00
|
|
|
Undid operation: b5bdbb51ab28 (2001-02-03 08:05:17) duplicate 1 commit(s)
|
2024-09-12 14:20:57 +00:00
|
|
|
"#);
|
2023-10-10 11:59:18 +00:00
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate" /* duplicates `c` */]);
|
2023-10-10 11:07:06 +00:00
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2024-03-15 08:35:52 +00:00
|
|
|
Duplicated 17a00fc21654 as lylxulpl ef3b0f3d c
|
2023-01-15 05:59:31 +00:00
|
|
|
"###);
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#"
|
|
|
|
@ 17a00fc21654 c
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╮
|
2024-09-21 06:01:33 +00:00
|
|
|
│ │ ○ ef3b0f3d1046 c
|
2023-02-09 02:53:47 +00:00
|
|
|
╭─┬─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
│ ○ d370aee184ba b
|
|
|
|
○ │ 2443ea76b0b1 a
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
"#);
|
2023-01-15 05:59:31 +00:00
|
|
|
}
|
|
|
|
|
2023-01-10 06:54:10 +00:00
|
|
|
#[test]
|
|
|
|
fn test_duplicate_many() {
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2023-01-10 06:54:10 +00:00
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
create_commit(&test_env, &repo_path, "a", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "b", &["a"]);
|
|
|
|
create_commit(&test_env, &repo_path, "c", &["a"]);
|
|
|
|
create_commit(&test_env, &repo_path, "d", &["c"]);
|
|
|
|
create_commit(&test_env, &repo_path, "e", &["b", "d"]);
|
|
|
|
// Test the setup
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
@ 921dde6e55c0 e
|
|
|
|
├─╮
|
2024-07-15 22:20:10 +00:00
|
|
|
│ ○ ebd06dba20ec d
|
|
|
|
│ ○ c0cb3a0b73e7 c
|
|
|
|
○ │ 1394f625cbbd b
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
○ 2443ea76b0b1 a
|
|
|
|
◆ 000000000000
|
2023-01-10 06:54:10 +00:00
|
|
|
"###);
|
|
|
|
|
2023-10-10 11:59:18 +00:00
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "b::"]);
|
2023-10-10 11:07:06 +00:00
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2023-07-11 01:46:38 +00:00
|
|
|
Duplicated 1394f625cbbd as wqnwkozp 3b74d969 b
|
|
|
|
Duplicated 921dde6e55c0 as mouksmqu 8348ddce e
|
2023-01-10 06:54:10 +00:00
|
|
|
"###);
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#"
|
|
|
|
@ 921dde6e55c0 e
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╮
|
2024-09-21 06:01:33 +00:00
|
|
|
○ │ 1394f625cbbd b
|
|
|
|
│ │ ○ 8348ddcec733 e
|
2023-02-09 02:53:47 +00:00
|
|
|
│ ╭─┤
|
2024-07-15 22:20:10 +00:00
|
|
|
│ ○ │ ebd06dba20ec d
|
|
|
|
│ ○ │ c0cb3a0b73e7 c
|
2023-07-28 06:51:08 +00:00
|
|
|
├─╯ │
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ 3b74d9691015 b
|
2023-02-09 02:53:47 +00:00
|
|
|
├───╯
|
2024-07-15 22:20:10 +00:00
|
|
|
○ 2443ea76b0b1 a
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
"#);
|
2023-01-10 06:54:10 +00:00
|
|
|
|
|
|
|
// Try specifying the same commit twice directly
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "b", "b"]);
|
2023-10-10 11:07:06 +00:00
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2023-07-11 01:46:38 +00:00
|
|
|
Duplicated 1394f625cbbd as nkmrtpmo 0276d3d7 b
|
2023-01-10 06:54:10 +00:00
|
|
|
"###);
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#"
|
|
|
|
@ 921dde6e55c0 e
|
|
|
|
├─╮
|
|
|
|
│ ○ ebd06dba20ec d
|
|
|
|
│ ○ c0cb3a0b73e7 c
|
|
|
|
○ │ 1394f625cbbd b
|
|
|
|
├─╯
|
|
|
|
│ ○ 0276d3d7c24d b
|
revset_graph: group commits topologically
The original idea was similar to Mercurial's "topo" sorting, but it was bad
at handling merge-heavy history. In order to render merges of topic branches
nicely, we need to prioritize branches at merge point, not at fork point.
OTOH, we do also want to place unmerged branches as close to the fork point
as possible. This commit implements the former requirement, and the latter
will be addressed by the next commit.
I think this is similar to Git's sorting logic described in the following blog
post. In our case, the in-degree walk can be dumb since topological order is
guaranteed by the index. We keep HashSet<CommitId> instead of an in-degree
integer value, which will be used in the next commit to resolve new heads as
late as possible.
https://github.blog/2022-08-30-gits-database-internals-ii-commit-history-queries/#topological-sorting
Compared to Sapling's beautify_graph(), this is lazy, and can roughly preserve
the index (or chronological) order. I tried beautify_graph() with prioritizing
the @ commit, but the result seemed too aggressively reordered. Perhaps, for
more complex history, beautify_graph() would produce a better result. For my
wip branches (~30 branches, a couple of commits per branch), this works pretty
well.
#242
2023-07-16 10:47:46 +00:00
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
○ 2443ea76b0b1 a
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
"#);
|
2023-01-10 06:54:10 +00:00
|
|
|
|
|
|
|
// Try specifying the same commit twice indirectly
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "b::", "d::"]);
|
2023-10-10 11:07:06 +00:00
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2023-07-11 01:46:38 +00:00
|
|
|
Duplicated 1394f625cbbd as xtnwkqum fa167d18 b
|
|
|
|
Duplicated ebd06dba20ec as pqrnrkux 2181781b d
|
|
|
|
Duplicated 921dde6e55c0 as ztxkyksq 0f7430f2 e
|
2023-01-10 06:54:10 +00:00
|
|
|
"###);
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#"
|
|
|
|
@ 921dde6e55c0 e
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╮
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ ebd06dba20ec d
|
|
|
|
○ │ 1394f625cbbd b
|
|
|
|
│ │ ○ 0f7430f2727a e
|
2023-02-09 02:53:47 +00:00
|
|
|
│ │ ├─╮
|
2024-09-21 06:01:33 +00:00
|
|
|
│ │ │ ○ 2181781b4f81 d
|
revset_graph: group commits topologically
The original idea was similar to Mercurial's "topo" sorting, but it was bad
at handling merge-heavy history. In order to render merges of topic branches
nicely, we need to prioritize branches at merge point, not at fork point.
OTOH, we do also want to place unmerged branches as close to the fork point
as possible. This commit implements the former requirement, and the latter
will be addressed by the next commit.
I think this is similar to Git's sorting logic described in the following blog
post. In our case, the in-degree walk can be dumb since topological order is
guaranteed by the index. We keep HashSet<CommitId> instead of an in-degree
integer value, which will be used in the next commit to resolve new heads as
late as possible.
https://github.blog/2022-08-30-gits-database-internals-ii-commit-history-queries/#topological-sorting
Compared to Sapling's beautify_graph(), this is lazy, and can roughly preserve
the index (or chronological) order. I tried beautify_graph() with prioritizing
the @ commit, but the result seemed too aggressively reordered. Perhaps, for
more complex history, beautify_graph() would produce a better result. For my
wip branches (~30 branches, a couple of commits per branch), this works pretty
well.
#242
2023-07-16 10:47:46 +00:00
|
|
|
│ ├───╯
|
2024-07-15 22:20:10 +00:00
|
|
|
│ ○ │ c0cb3a0b73e7 c
|
2023-07-28 06:51:08 +00:00
|
|
|
├─╯ │
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ fa167d18a83a b
|
revset_graph: group commits topologically
The original idea was similar to Mercurial's "topo" sorting, but it was bad
at handling merge-heavy history. In order to render merges of topic branches
nicely, we need to prioritize branches at merge point, not at fork point.
OTOH, we do also want to place unmerged branches as close to the fork point
as possible. This commit implements the former requirement, and the latter
will be addressed by the next commit.
I think this is similar to Git's sorting logic described in the following blog
post. In our case, the in-degree walk can be dumb since topological order is
guaranteed by the index. We keep HashSet<CommitId> instead of an in-degree
integer value, which will be used in the next commit to resolve new heads as
late as possible.
https://github.blog/2022-08-30-gits-database-internals-ii-commit-history-queries/#topological-sorting
Compared to Sapling's beautify_graph(), this is lazy, and can roughly preserve
the index (or chronological) order. I tried beautify_graph() with prioritizing
the @ commit, but the result seemed too aggressively reordered. Perhaps, for
more complex history, beautify_graph() would produce a better result. For my
wip branches (~30 branches, a couple of commits per branch), this works pretty
well.
#242
2023-07-16 10:47:46 +00:00
|
|
|
├───╯
|
2024-07-15 22:20:10 +00:00
|
|
|
○ 2443ea76b0b1 a
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
"#);
|
2023-01-10 06:54:10 +00:00
|
|
|
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
2023-01-10 06:54:10 +00:00
|
|
|
// Reminder of the setup
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
@ 921dde6e55c0 e
|
|
|
|
├─╮
|
2024-07-15 22:20:10 +00:00
|
|
|
│ ○ ebd06dba20ec d
|
|
|
|
│ ○ c0cb3a0b73e7 c
|
|
|
|
○ │ 1394f625cbbd b
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
○ 2443ea76b0b1 a
|
|
|
|
◆ 000000000000
|
2023-01-10 06:54:10 +00:00
|
|
|
"###);
|
2023-10-10 11:59:18 +00:00
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "d::", "a"]);
|
2023-10-10 11:07:06 +00:00
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2023-07-11 01:46:38 +00:00
|
|
|
Duplicated 2443ea76b0b1 as nlrtlrxv c6f7f8c4 a
|
|
|
|
Duplicated ebd06dba20ec as plymsszl d94e4c55 d
|
|
|
|
Duplicated 921dde6e55c0 as urrlptpw 9bd4389f e
|
2023-01-10 06:54:10 +00:00
|
|
|
"###);
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#"
|
|
|
|
@ 921dde6e55c0 e
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╮
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ ebd06dba20ec d
|
|
|
|
│ │ ○ 9bd4389f5d47 e
|
2023-07-28 06:51:08 +00:00
|
|
|
╭───┤
|
2024-09-21 06:01:33 +00:00
|
|
|
│ │ ○ d94e4c55a68b d
|
2023-07-28 06:51:08 +00:00
|
|
|
│ ├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
│ ○ c0cb3a0b73e7 c
|
|
|
|
○ │ 1394f625cbbd b
|
2023-07-22 18:14:03 +00:00
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
○ 2443ea76b0b1 a
|
|
|
|
│ ○ c6f7f8c4512e a
|
2023-07-22 18:14:03 +00:00
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
"#);
|
2023-01-10 06:54:10 +00:00
|
|
|
|
|
|
|
// Check for BUG -- makes too many 'a'-s, etc.
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a::"]);
|
2023-10-10 11:07:06 +00:00
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2023-07-11 01:46:38 +00:00
|
|
|
Duplicated 2443ea76b0b1 as uuuvxpvw 0fe67a05 a
|
|
|
|
Duplicated 1394f625cbbd as nmpuuozl e13ac0ad b
|
|
|
|
Duplicated c0cb3a0b73e7 as kzpokyyw df53fa58 c
|
|
|
|
Duplicated ebd06dba20ec as yxrlprzz 2f2442db d
|
|
|
|
Duplicated 921dde6e55c0 as mvkzkxrl ee8fe64e e
|
2023-01-10 06:54:10 +00:00
|
|
|
"###);
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#"
|
|
|
|
@ 921dde6e55c0 e
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╮
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ ebd06dba20ec d
|
|
|
|
│ ○ c0cb3a0b73e7 c
|
|
|
|
○ │ 1394f625cbbd b
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╯
|
2024-09-21 06:01:33 +00:00
|
|
|
○ 2443ea76b0b1 a
|
|
|
|
│ ○ ee8fe64ed254 e
|
2023-02-09 02:53:47 +00:00
|
|
|
│ ├─╮
|
2024-09-21 06:01:33 +00:00
|
|
|
│ │ ○ 2f2442db08eb d
|
|
|
|
│ │ ○ df53fa589286 c
|
|
|
|
│ ○ │ e13ac0adabdf b
|
2023-02-09 02:53:47 +00:00
|
|
|
│ ├─╯
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ 0fe67a05989e a
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
"#);
|
2023-01-10 06:54:10 +00:00
|
|
|
}
|
|
|
|
|
2024-06-01 18:39:22 +00:00
|
|
|
#[test]
|
|
|
|
fn test_duplicate_destination() {
|
|
|
|
let test_env = TestEnvironment::default();
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
create_commit(&test_env, &repo_path, "a1", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "a2", &["a1"]);
|
|
|
|
create_commit(&test_env, &repo_path, "a3", &["a2"]);
|
|
|
|
create_commit(&test_env, &repo_path, "b", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "c", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "d", &[]);
|
|
|
|
let setup_opid = test_env.current_operation_id(&repo_path);
|
|
|
|
|
|
|
|
// Test the setup
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#"
|
|
|
|
@ f7550bb42c6f d
|
|
|
|
│ ○ b75b7aa4b90e c
|
|
|
|
├─╯
|
|
|
|
│ ○ 9a27d5939bef b
|
|
|
|
├─╯
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
|
|
|
"#);
|
|
|
|
|
|
|
|
// Duplicate a single commit onto a single destination.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "-d", "c"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @"Duplicated 9e85a474f005 as nkmrtpmo 2944a632 a1");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ f7550bb42c6f d
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 2944a6324f14 a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ b75b7aa4b90e c
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
|
|
|
│ ○ 9a27d5939bef b
|
|
|
|
├─╯
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate a single commit onto multiple destinations.
|
|
|
|
let (stdout, stderr) =
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "-d", "c", "-d", "d"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @"Duplicated 9e85a474f005 as xtnwkqum 155f6a01 a1");
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
○ 155f6a012334 a1
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╮
|
|
|
|
│ @ f7550bb42c6f d
|
|
|
|
○ │ b75b7aa4b90e c
|
|
|
|
├─╯
|
|
|
|
│ ○ 9a27d5939bef b
|
|
|
|
├─╯
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate a single commit onto its descendant.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "-d", "a3"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 9e85a474f005 as a descendant of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 9e85a474f005 as wvuyspvk 95585bb2 (empty) a1
|
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ f7550bb42c6f d
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ b75b7aa4b90e c
|
|
|
|
├─╯
|
|
|
|
│ ○ 9a27d5939bef b
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 95585bb2fe05 a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
// Duplicate multiple commits without a direct ancestry relationship onto a
|
|
|
|
// single destination.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "b", "-d", "c"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as xlzxqlsl da0996fd a1
|
|
|
|
Duplicated 9a27d5939bef as vnkwvqxw 0af91ca8 b
|
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ f7550bb42c6f d
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 0af91ca82d9c b
|
|
|
|
│ │ ○ da0996fda8ce a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╯
|
|
|
|
│ ○ b75b7aa4b90e c
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
|
|
|
│ ○ 9a27d5939bef b
|
|
|
|
├─╯
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits without a direct ancestry relationship onto
|
|
|
|
// multiple destinations.
|
|
|
|
let (stdout, stderr) =
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "b", "-d", "c", "-d", "d"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as oupztwtk 2f519daa a1
|
|
|
|
Duplicated 9a27d5939bef as yxsqzptr c219a744 b
|
|
|
|
");
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
○ c219a744e19c b
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ ○ 2f519daab24d a1
|
2024-06-01 18:39:22 +00:00
|
|
|
╭─┬─╯
|
|
|
|
│ @ f7550bb42c6f d
|
|
|
|
○ │ b75b7aa4b90e c
|
|
|
|
├─╯
|
|
|
|
│ ○ 9a27d5939bef b
|
|
|
|
├─╯
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship onto a
|
|
|
|
// single destination.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "a3", "-d", "c"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as wtszoswq 806f2b56 a1
|
|
|
|
Duplicated 17072aa2b823 as qmykwtmu 161ce874 a3
|
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ f7550bb42c6f d
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 161ce87408d5 a3
|
|
|
|
│ ○ 806f2b56207d a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ b75b7aa4b90e c
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
|
|
|
│ ○ 9a27d5939bef b
|
|
|
|
├─╯
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship onto
|
|
|
|
// multiple destinations.
|
|
|
|
let (stdout, stderr) =
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "a3", "-d", "c", "-d", "d"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as rkoyqlrv 02cbff23 a1
|
|
|
|
Duplicated 17072aa2b823 as zxvrqtmq ddcfb95f a3
|
|
|
|
");
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
○ ddcfb95ff7d8 a3
|
|
|
|
○ 02cbff23a61d a1
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╮
|
|
|
|
│ @ f7550bb42c6f d
|
|
|
|
○ │ b75b7aa4b90e c
|
|
|
|
├─╯
|
|
|
|
│ ○ 9a27d5939bef b
|
|
|
|
├─╯
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_duplicate_insert_after() {
|
|
|
|
let test_env = TestEnvironment::default();
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
create_commit(&test_env, &repo_path, "a1", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "a2", &["a1"]);
|
|
|
|
create_commit(&test_env, &repo_path, "a3", &["a2"]);
|
|
|
|
create_commit(&test_env, &repo_path, "a4", &["a3"]);
|
|
|
|
create_commit(&test_env, &repo_path, "b1", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "b2", &["b1"]);
|
|
|
|
create_commit(&test_env, &repo_path, "c1", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "c2", &["c1"]);
|
|
|
|
create_commit(&test_env, &repo_path, "d1", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "d2", &["d1"]);
|
|
|
|
let setup_opid = test_env.current_operation_id(&repo_path);
|
|
|
|
|
|
|
|
// Test the setup
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
|
|
|
"#);
|
|
|
|
|
|
|
|
// Duplicate a single commit after a single commit with no direct relationship.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "--after", "b1"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as pzsxstzt b71e23da a1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ af12531fa2dc b2
|
|
|
|
│ ○ b71e23da3559 a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate a single commit after a single ancestor commit.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a3", "--after", "a1"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 17072aa2b823 as an ancestor of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 17072aa2b823 as qmkrwlvp fd3c891b a3
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 3 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 027d38df36fa a4
|
|
|
|
│ ○ 6cb0f5884a35 a3
|
|
|
|
│ ○ 80e3e40b66f0 a2
|
|
|
|
│ ○ fd3c891b8b97 a3
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate a single commit after a single descendant commit.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "--after", "a3"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 9e85a474f005 as a descendant of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 9e85a474f005 as qwyusntz a4d0b771 (empty) a1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 9fe3808a9067 a4
|
|
|
|
│ ○ a4d0b7715767 a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate a single commit after multiple commits with no direct
|
|
|
|
// relationship.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "--after", "b1", "--after", "c1"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as soqnvnyz 3449bde2 a1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 2 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ c997a412ac93 c2
|
|
|
|
│ │ ○ e570747744ed b2
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 3449bde20037 a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
|
|
|
│ │ ○ b27346e9a9bd c1
|
|
|
|
├───╯
|
|
|
|
│ ○ dcc98bc8bbea b1
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate a single commit after multiple commits including an ancestor.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a3", "--after", "a2", "--after", "b2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 17072aa2b823 as an ancestor of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 17072aa2b823 as nsrwusvy 48764702 a3
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 2 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ aead471d6dc8 a4
|
|
|
|
│ ○ 07fb2a10b5de a3
|
|
|
|
│ ○ 48764702c97c a3
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
|
|
|
│ │ ○ 7b44470918f4 b2
|
|
|
|
│ │ ○ dcc98bc8bbea b1
|
|
|
|
├───╯
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate a single commit after multiple commits including a descendant.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "--after", "a3", "--after", "b2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 9e85a474f005 as a descendant of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 9e85a474f005 as xpnwykqz 43bcb4dc (empty) a1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 92782f7d24fe a4
|
|
|
|
│ ○ 43bcb4dc97f4 a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
|
|
|
│ │ ○ 7b44470918f4 b2
|
|
|
|
│ │ ○ dcc98bc8bbea b1
|
|
|
|
├───╯
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits without a direct ancestry relationship after a
|
|
|
|
// single commit without a direct relationship.
|
|
|
|
let (stdout, stderr) =
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "b1", "--after", "c1"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as sryyqqkq 44f57f24 a1
|
|
|
|
Duplicated dcc98bc8bbea as pxnqtknr bcee4b60 b1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 215600d39fed c2
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ ○ bcee4b6058e4 b1
|
|
|
|
│ ○ │ 44f57f247bf2 a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╯
|
|
|
|
│ ○ b27346e9a9bd c1
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits without a direct ancestry relationship after a
|
|
|
|
// single commit which is an ancestor of one of the duplicated commits.
|
|
|
|
let (stdout, stderr) =
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["duplicate", "a3", "b1", "--after", "a2"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 17072aa2b823 as an ancestor of itself
|
|
|
|
Duplicated 17072aa2b823 as pyoswmwk 0d11d466 a3
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated dcc98bc8bbea as yqnpwwmq c32d1ccc b1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 2 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 955959f7bb42 a4
|
|
|
|
│ ○ 7b2b1ab433f0 a3
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ ○ c32d1ccc8d5b b1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ │ 0d11d4667aa9 a3
|
|
|
|
│ ├─╯
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits without a direct ancestry relationship after a
|
|
|
|
// single commit which is a descendant of one of the duplicated commits.
|
|
|
|
let (stdout, stderr) =
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "b1", "--after", "a3"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 9e85a474f005 as a descendant of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 9e85a474f005 as tpmlxquz 213aff50 (empty) a1
|
|
|
|
Duplicated dcc98bc8bbea as uukzylyy 67b82bab b1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 9457bd90ac07 a4
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ ○ 67b82babd5f6 b1
|
|
|
|
│ ○ │ 213aff50a82b a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╯
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits without a direct ancestry relationship after
|
|
|
|
// multiple commits without a direct relationship to the duplicated commits.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "b1", "--after", "c1", "--after", "d1"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as knltnxnu ad0a80e9 a1
|
|
|
|
Duplicated dcc98bc8bbea as krtqozmx 840bbbe5 b1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 2 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
Working copy now at: nmzmmopx 9eeade97 d2 | d2
|
|
|
|
Parent commit : knltnxnu ad0a80e9 a1
|
|
|
|
Parent commit : krtqozmx 840bbbe5 b1
|
|
|
|
Added 3 files, modified 0 files, removed 0 files
|
|
|
|
");
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 9eeade97a2f7 d2
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ ○ cd045e3862be c2
|
2024-06-01 18:39:22 +00:00
|
|
|
╭─┬─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 840bbbe57acb b1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
○ │ │ ad0a80e9b011 a1
|
2024-06-01 18:39:22 +00:00
|
|
|
╰─┬─╮
|
|
|
|
│ ○ 0f21c5e185c5 d1
|
|
|
|
○ │ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
○ │ 7b44470918f4 b2
|
|
|
|
○ │ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits without a direct ancestry relationship after
|
|
|
|
// multiple commits including an ancestor of one of the duplicated commits.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a3", "b1", "--after", "a1", "--after", "c1"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 17072aa2b823 as an ancestor of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 17072aa2b823 as wxzmtyol ade2ae32 a3
|
|
|
|
Duplicated dcc98bc8bbea as musouqkq e1eed3f1 b1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 4 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 12a208423aa9 c2
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ │ ○ c804d94310fd a4
|
|
|
|
│ │ │ ○ e22e44ff5f22 a3
|
|
|
|
│ │ │ ○ 6ee77bdfc821 a2
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ╭─┬─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ ○ e1eed3f1c77c b1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ │ ├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ │ │ ade2ae32950a a3
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ╰─┬─╮
|
|
|
|
│ │ ○ b27346e9a9bd c1
|
|
|
|
├─────╯
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├───╯
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits without a direct ancestry relationship after
|
|
|
|
// multiple commits including a descendant of one of the duplicated commits.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "b1", "--after", "a3", "--after", "c2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 9e85a474f005 as a descendant of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 9e85a474f005 as quyylypw c4820edd (empty) a1
|
|
|
|
Duplicated dcc98bc8bbea as prukwozq 20cfd11e b1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 2d04909f04b5 a4
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ ○ 20cfd11ee3c3 b1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ │ ├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ │ │ c4820eddcd3c a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ╰─┬─╮
|
|
|
|
│ │ ○ 09560d60cac4 c2
|
|
|
|
│ │ ○ b27346e9a9bd c1
|
|
|
|
├─────╯
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├───╯
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship after a single
|
|
|
|
// commit without a direct relationship.
|
|
|
|
let (stdout, stderr) =
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "a3", "--after", "c2"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as vvvtksvt b44d23b4 a1
|
|
|
|
Duplicated 17072aa2b823 as yvrnrpnw ca8f08f6 a3
|
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ ca8f08f66c5c a3
|
|
|
|
│ ○ b44d23b4c98e a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship after a single
|
|
|
|
// ancestor commit.
|
|
|
|
let (stdout, stderr) =
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["duplicate", "a2", "a3", "--after", "a1"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r#"
|
|
|
|
Warning: Duplicating commit 17072aa2b823 as an ancestor of itself
|
|
|
|
Warning: Duplicating commit 47df67757a64 as an ancestor of itself
|
|
|
|
Duplicated 47df67757a64 as sukptuzs 4324d289 a2
|
|
|
|
Duplicated 17072aa2b823 as rxnrppxl 47586b09 a3
|
|
|
|
Rebased 3 commits onto duplicated commits
|
|
|
|
"#);
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ 2174f54d55a9 a4
|
|
|
|
│ ○ 0224bfb4fc3d a3
|
|
|
|
│ ○ 22d3bdc60967 a2
|
|
|
|
│ ○ 47586b09a555 a3
|
|
|
|
│ ○ 4324d289e62c a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship after a single
|
|
|
|
// descendant commit.
|
|
|
|
let (stdout, stderr) =
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "a2", "--after", "a3"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 47df67757a64 as a descendant of itself
|
|
|
|
Warning: Duplicating commit 9e85a474f005 as a descendant of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 9e85a474f005 as rwkyzntp b68b9a00 (empty) a1
|
|
|
|
Duplicated 47df67757a64 as nqtyztop 0dd00ded (empty) a2
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 4f02390e56aa a4
|
|
|
|
│ ○ 0dd00dedd0c5 a2
|
|
|
|
│ ○ b68b9a0073cb a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship after multiple
|
|
|
|
// commits without a direct relationship to the duplicated commits.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "a3", "--after", "c2", "--after", "d2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as nwmqwkzz eb455287 a1
|
|
|
|
Duplicated 17072aa2b823 as uwrrnrtx 94a1bd80 a3
|
|
|
|
");
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
○ 94a1bd8080c6 a3
|
|
|
|
○ eb455287f1eb a1
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╮
|
|
|
|
│ @ 0cdd923e993a d2
|
|
|
|
│ ○ 0f21c5e185c5 d1
|
|
|
|
○ │ 09560d60cac4 c2
|
|
|
|
○ │ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship after multiple
|
|
|
|
// commits including an ancestor of one of the duplicated commits.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a3", "a4", "--after", "a2", "--after", "c2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 196bc1f0efc1 as an ancestor of itself
|
|
|
|
Warning: Duplicating commit 17072aa2b823 as an ancestor of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 17072aa2b823 as wunttkrp 1ce432e1 a3
|
|
|
|
Duplicated 196bc1f0efc1 as puxpuzrm 14728ee8 a4
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 2 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 5fa41821880b a4
|
|
|
|
│ ○ 52554e3e9729 a3
|
|
|
|
│ ○ 14728ee84976 a4
|
|
|
|
│ ○ 1ce432e1b0ea a3
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
|
|
|
│ │ ○ 09560d60cac4 c2
|
|
|
|
│ │ ○ b27346e9a9bd c1
|
|
|
|
├───╯
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship after multiple
|
|
|
|
// commits including a descendant of one of the duplicated commits.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "a2", "--after", "a3", "--after", "c2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 47df67757a64 as a descendant of itself
|
|
|
|
Warning: Duplicating commit 9e85a474f005 as a descendant of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 9e85a474f005 as zwvplpop 67dd65d3 (empty) a1
|
|
|
|
Duplicated 47df67757a64 as znsksvls 7536fd44 (empty) a2
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 83aa2cfb2448 a4
|
|
|
|
│ ○ 7536fd4475cd a2
|
|
|
|
│ ○ 67dd65d3d47a a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
|
|
|
│ │ ○ 09560d60cac4 c2
|
|
|
|
│ │ ○ b27346e9a9bd c1
|
|
|
|
├───╯
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Should error if a loop will be created.
|
|
|
|
let stderr = test_env.jj_cmd_failure(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "--after", "b1", "--after", "b2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stderr, @r#"
|
|
|
|
Error: Refusing to create a loop: commit 7b44470918f4 would be both an ancestor and a descendant of the duplicated commits
|
|
|
|
"#);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_duplicate_insert_before() {
|
|
|
|
let test_env = TestEnvironment::default();
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
create_commit(&test_env, &repo_path, "a1", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "a2", &["a1"]);
|
|
|
|
create_commit(&test_env, &repo_path, "a3", &["a2"]);
|
|
|
|
create_commit(&test_env, &repo_path, "a4", &["a3"]);
|
|
|
|
create_commit(&test_env, &repo_path, "b1", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "b2", &["b1"]);
|
|
|
|
create_commit(&test_env, &repo_path, "c1", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "c2", &["c1"]);
|
|
|
|
create_commit(&test_env, &repo_path, "d1", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "d2", &["d1"]);
|
|
|
|
let setup_opid = test_env.current_operation_id(&repo_path);
|
|
|
|
|
|
|
|
// Test the setup
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
|
|
|
"#);
|
|
|
|
|
|
|
|
// Duplicate a single commit before a single commit with no direct relationship.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "--before", "b2"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as pzsxstzt b71e23da a1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ af12531fa2dc b2
|
|
|
|
│ ○ b71e23da3559 a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate a single commit before a single ancestor commit.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a3", "--before", "a1"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 17072aa2b823 as an ancestor of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 17072aa2b823 as qmkrwlvp 2108707c a3
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 4 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ ef93a98b9dba a4
|
|
|
|
│ ○ 5952e93b6237 a3
|
|
|
|
│ ○ f9baa38681ce a2
|
|
|
|
│ ○ 3096149ab785 a1
|
|
|
|
│ ○ 2108707c8d39 a3
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate a single commit before a single descendant commit.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "--before", "a3"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 9e85a474f005 as a descendant of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 9e85a474f005 as qwyusntz 2fe2d212 (empty) a1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 2 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 664fce416f57 a4
|
|
|
|
│ ○ 547efe815e18 a3
|
|
|
|
│ ○ 2fe2d21257c9 a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate a single commit before multiple commits with no direct
|
|
|
|
// relationship.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "--before", "b2", "--before", "c2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as soqnvnyz 3449bde2 a1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 2 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ c997a412ac93 c2
|
|
|
|
│ │ ○ e570747744ed b2
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 3449bde20037 a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
|
|
|
│ │ ○ b27346e9a9bd c1
|
|
|
|
├───╯
|
|
|
|
│ ○ dcc98bc8bbea b1
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate a single commit before multiple commits including an ancestor.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a3", "--before", "a2", "--before", "b2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 17072aa2b823 as an ancestor of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 17072aa2b823 as nsrwusvy 8648c1c8 a3
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 4 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 1722fb59dee6 b2
|
|
|
|
│ │ ○ cdeff7751fb6 a4
|
|
|
|
│ │ ○ 28f70dc150b8 a3
|
|
|
|
│ │ ○ f38e6d30913d a2
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 8648c1c894f0 a3
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
|
|
|
│ │ ○ dcc98bc8bbea b1
|
|
|
|
├───╯
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate a single commit before multiple commits including a descendant.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "--before", "a3", "--before", "b2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 9e85a474f005 as a descendant of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 9e85a474f005 as xpnwykqz 72cf8983 (empty) a1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 3 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ d78b124079a4 b2
|
|
|
|
│ │ ○ 490d6138ef36 a4
|
|
|
|
│ │ ○ e349d271ef64 a3
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 72cf89838d1a a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
|
|
|
│ │ ○ dcc98bc8bbea b1
|
|
|
|
├───╯
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits without a direct ancestry relationship before a
|
|
|
|
// single commit without a direct relationship.
|
|
|
|
let (stdout, stderr) =
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "b1", "--before", "c1"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r#"
|
|
|
|
Duplicated 9e85a474f005 as sryyqqkq fa625d74 a1
|
|
|
|
Duplicated dcc98bc8bbea as pxnqtknr 2233b9a8 b1
|
|
|
|
Rebased 2 commits onto duplicated commits
|
|
|
|
"#);
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
|
|
|
│ ○ cf7c4c4cc8bc c2
|
|
|
|
│ ○ 6412acdac711 c1
|
|
|
|
│ ├─╮
|
|
|
|
│ │ ○ 2233b9a87d86 b1
|
|
|
|
├───╯
|
|
|
|
│ ○ fa625d74e0ae a1
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits without a direct ancestry relationship before a
|
|
|
|
// single commit which is an ancestor of one of the duplicated commits.
|
|
|
|
let (stdout, stderr) =
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["duplicate", "a3", "b1", "--before", "a2"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 17072aa2b823 as an ancestor of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 17072aa2b823 as pyoswmwk cad067c7 a3
|
|
|
|
Duplicated dcc98bc8bbea as yqnpwwmq 6675be66 b1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 3 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 17391b843937 a4
|
|
|
|
│ ○ 23f979220309 a3
|
|
|
|
│ ○ 15a3207cfa72 a2
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ ○ 6675be66b280 b1
|
|
|
|
│ ○ │ cad067c7d304 a3
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╯
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits without a direct ancestry relationship before a
|
|
|
|
// single commit which is a descendant of one of the duplicated commits.
|
|
|
|
let (stdout, stderr) =
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "b1", "--before", "a3"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 9e85a474f005 as a descendant of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 9e85a474f005 as tpmlxquz 4d4dc78c (empty) a1
|
|
|
|
Duplicated dcc98bc8bbea as uukzylyy a065abc9 b1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 2 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ adb92c147726 a4
|
|
|
|
│ ○ fb156cb07e68 a3
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ ○ a065abc9c61f b1
|
|
|
|
│ ○ │ 4d4dc78c70a7 a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╯
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits without a direct ancestry relationship before
|
|
|
|
// multiple commits without a direct relationship to the duplicated commits.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "b1", "--before", "c1", "--before", "d1"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r#"
|
|
|
|
Duplicated 9e85a474f005 as knltnxnu 056a0cb3 a1
|
|
|
|
Duplicated dcc98bc8bbea as krtqozmx fb68a539 b1
|
|
|
|
Rebased 4 commits onto duplicated commits
|
|
|
|
Working copy now at: nmzmmopx 89f9b379 d2 | d2
|
|
|
|
Parent commit : xznxytkn 771d0e16 d1 | d1
|
|
|
|
Added 2 files, modified 0 files, removed 0 files
|
|
|
|
"#);
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#"
|
|
|
|
@ 89f9b37923a9 d2
|
|
|
|
○ 771d0e16b40c d1
|
|
|
|
├─╮
|
|
|
|
│ │ ○ 7e7653d32cf1 c2
|
|
|
|
│ │ ○ a83b8a44f3fc c1
|
|
|
|
╭─┬─╯
|
|
|
|
│ ○ fb68a539aea7 b1
|
|
|
|
○ │ 056a0cb391f8 a1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
|
|
|
"#);
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits without a direct ancestry relationship before
|
|
|
|
// multiple commits including an ancestor of one of the duplicated commits.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a3", "b1", "--before", "a1", "--before", "c1"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 17072aa2b823 as an ancestor of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 17072aa2b823 as wxzmtyol 31ca96b8 a3
|
2024-06-01 18:39:22 +00:00
|
|
|
Duplicated dcc98bc8bbea as musouqkq 4748cf83 b1
|
|
|
|
Rebased 6 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ aa431fa5a467 c2
|
|
|
|
│ ○ f99bc6bf1b1c c1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ │ ○ a38ca6dc28f3 a4
|
|
|
|
│ │ │ ○ 16e3d6c1562a a3
|
|
|
|
│ │ │ ○ 84b5c2b584d1 a2
|
|
|
|
│ │ │ ○ cc4ae3a9a31d a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ╭─┬─╯
|
|
|
|
│ │ ○ 4748cf83e26e b1
|
|
|
|
├───╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 31ca96b88527 a3
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits without a direct ancestry relationship before
|
|
|
|
// multiple commits including a descendant of one of the duplicated commits.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "b1", "--before", "a3", "--before", "c2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 9e85a474f005 as a descendant of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 9e85a474f005 as quyylypw 3eefd57d (empty) a1
|
|
|
|
Duplicated dcc98bc8bbea as prukwozq ed86e70f b1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 3 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 1c0d40fa21ea c2
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ │ ○ c31979bb15d4 a4
|
|
|
|
│ │ │ ○ 8daf2e842412 a3
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ╭─┬─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ ○ ed86e70f497f b1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ │ ├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ │ │ 3eefd57d676b a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ╰─┬─╮
|
|
|
|
│ │ ○ b27346e9a9bd c1
|
|
|
|
├─────╯
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├───╯
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship before a single
|
|
|
|
// commit without a direct relationship.
|
|
|
|
let (stdout, stderr) =
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "a3", "--before", "c2"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as vvvtksvt baee09af a1
|
|
|
|
Duplicated 17072aa2b823 as yvrnrpnw c17818c1 a3
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 4a25ce233a30 c2
|
|
|
|
│ ○ c17818c175df a3
|
|
|
|
│ ○ baee09af0f75 a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ b27346e9a9bd c1
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship before a single
|
|
|
|
// ancestor commit.
|
|
|
|
let (stdout, stderr) =
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "a3", "--before", "a1"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 17072aa2b823 as an ancestor of itself
|
|
|
|
Warning: Duplicating commit 9e85a474f005 as an ancestor of itself
|
|
|
|
Duplicated 9e85a474f005 as sukptuzs ad0234a3 a1
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 17072aa2b823 as rxnrppxl e64dcdd1 a3
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 4 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 76cbe9641be2 a4
|
|
|
|
│ ○ 140c783a30c6 a3
|
|
|
|
│ ○ 940c74f17140 a2
|
|
|
|
│ ○ d359f7d9dfe7 a1
|
|
|
|
│ ○ e64dcdd1d1d1 a3
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ ad0234a34661 a1
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship before a single
|
|
|
|
// descendant commit.
|
|
|
|
let (stdout, stderr) =
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "a2", "--before", "a3"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 47df67757a64 as a descendant of itself
|
|
|
|
Warning: Duplicating commit 9e85a474f005 as a descendant of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 9e85a474f005 as rwkyzntp e614bda1 (empty) a1
|
|
|
|
Duplicated 47df67757a64 as nqtyztop 5de52186 (empty) a2
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 2 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 585cb65f6d57 a4
|
|
|
|
│ ○ b75dd23ffef0 a3
|
|
|
|
│ ○ 5de52186bdf3 a2
|
|
|
|
│ ○ e614bda1f2dc a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship before multiple
|
|
|
|
// commits without a direct relationship to the duplicated commits.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "a3", "--before", "c2", "--before", "d2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as nwmqwkzz 9963be9b a1
|
|
|
|
Duplicated 17072aa2b823 as uwrrnrtx a5eee87f a3
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 2 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
Working copy now at: nmzmmopx 8161bbbc d2 | d2
|
|
|
|
Parent commit : uwrrnrtx a5eee87f a3
|
|
|
|
Added 3 files, modified 0 files, removed 0 files
|
|
|
|
");
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 8161bbbc1341 d2
|
|
|
|
│ ○ 62eea4c098aa c2
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
○ a5eee87f5120 a3
|
|
|
|
○ 9963be9be4cd a1
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╮
|
|
|
|
│ ○ 0f21c5e185c5 d1
|
|
|
|
○ │ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship before multiple
|
|
|
|
// commits including an ancestor of one of the duplicated commits.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a3", "a4", "--before", "a2", "--before", "c2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 196bc1f0efc1 as an ancestor of itself
|
|
|
|
Warning: Duplicating commit 17072aa2b823 as an ancestor of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 17072aa2b823 as wunttkrp 11fcc721 a3
|
|
|
|
Duplicated 196bc1f0efc1 as puxpuzrm 3a0d76b0 a4
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 4 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ c7a0da69006c c2
|
|
|
|
│ │ ○ 8f35827d9ec9 a4
|
|
|
|
│ │ ○ 1ac63ccfda31 a3
|
|
|
|
│ │ ○ 96b02cd292f9 a2
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 3a0d76b0e8c2 a4
|
|
|
|
│ ○ 11fcc72145cc a3
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
|
|
|
│ │ ○ b27346e9a9bd c1
|
|
|
|
├───╯
|
|
|
|
│ ○ 9e85a474f005 a1
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship before multiple
|
|
|
|
// commits including a descendant of one of the duplicated commits.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "a2", "--before", "a3", "--before", "c2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 47df67757a64 as a descendant of itself
|
|
|
|
Warning: Duplicating commit 9e85a474f005 as a descendant of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 9e85a474f005 as zwvplpop 311e39e4 (empty) a1
|
|
|
|
Duplicated 47df67757a64 as znsksvls fdaa673d (empty) a2
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 3 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ f1f4e0efe9fb c2
|
|
|
|
│ │ ○ a5af2ec2ff05 a4
|
|
|
|
│ │ ○ 5d98ceaab6a5 a3
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ fdaa673dff14 a2
|
|
|
|
│ ○ 311e39e4de28 a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
|
|
|
│ │ ○ b27346e9a9bd c1
|
|
|
|
├───╯
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Should error if a loop will be created.
|
|
|
|
let stderr = test_env.jj_cmd_failure(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "--before", "b1", "--before", "b2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stderr, @r#"
|
|
|
|
Error: Refusing to create a loop: commit dcc98bc8bbea would be both an ancestor and a descendant of the duplicated commits
|
|
|
|
"#);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_duplicate_insert_after_before() {
|
|
|
|
let test_env = TestEnvironment::default();
|
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
create_commit(&test_env, &repo_path, "a1", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "a2", &["a1"]);
|
|
|
|
create_commit(&test_env, &repo_path, "a3", &["a2"]);
|
|
|
|
create_commit(&test_env, &repo_path, "a4", &["a3"]);
|
|
|
|
create_commit(&test_env, &repo_path, "b1", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "b2", &["b1"]);
|
|
|
|
create_commit(&test_env, &repo_path, "c1", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "c2", &["c1"]);
|
|
|
|
create_commit(&test_env, &repo_path, "d1", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "d2", &["d1"]);
|
|
|
|
let setup_opid = test_env.current_operation_id(&repo_path);
|
|
|
|
|
|
|
|
// Test the setup
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
|
|
|
"#);
|
|
|
|
|
|
|
|
// Duplicate a single commit in between commits with no direct relationship.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "--before", "b2", "--after", "c2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as pzsxstzt afc97ea4 a1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 41f0321a79b8 b2
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ ○ afc97ea480c1 a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ │ ○ 09560d60cac4 c2
|
|
|
|
│ │ ○ b27346e9a9bd c1
|
|
|
|
├───╯
|
|
|
|
│ ○ dcc98bc8bbea b1
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate a single commit in between ancestor commits.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a3", "--before", "a2", "--after", "a1"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 17072aa2b823 as an ancestor of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 17072aa2b823 as qmkrwlvp fd3c891b a3
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 3 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 027d38df36fa a4
|
|
|
|
│ ○ 6cb0f5884a35 a3
|
|
|
|
│ ○ 80e3e40b66f0 a2
|
|
|
|
│ ○ fd3c891b8b97 a3
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate a single commit in between an ancestor commit and a commit with no
|
|
|
|
// direct relationship.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a3", "--before", "a2", "--after", "b2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 17072aa2b823 as an ancestor of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 17072aa2b823 as qwyusntz 4d69f69c a3
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 3 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 1e4a9c0c8247 a4
|
|
|
|
│ ○ 416da6f255ef a3
|
|
|
|
│ ○ 335701a7e2f7 a2
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ ○ 4d69f69ca987 a3
|
2024-09-21 06:01:33 +00:00
|
|
|
│ │ ○ 7b44470918f4 b2
|
|
|
|
│ │ ○ dcc98bc8bbea b1
|
|
|
|
├───╯
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate a single commit in between descendant commits.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "--after", "a3", "--before", "a4"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 9e85a474f005 as a descendant of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 9e85a474f005 as soqnvnyz 00811f7c (empty) a1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ d6d9a67a7882 a4
|
|
|
|
│ ○ 00811f7ccdb5 a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate a single commit in between a descendant commit and a commit with no
|
|
|
|
// direct relationship.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "--after", "a3", "--before", "b2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 9e85a474f005 as a descendant of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 9e85a474f005 as nsrwusvy 0b89e8a3 (empty) a1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 71f4a83f7122 b2
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ ○ 0b89e8a32915 a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ │ dcc98bc8bbea b1
|
|
|
|
├─╯ │
|
|
|
|
│ ○ │ 196bc1f0efc1 a4
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ├─╯
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate a single commit in between an ancestor commit and a descendant
|
|
|
|
// commit.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a2", "--after", "a1", "--before", "a4"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r#"
|
|
|
|
Duplicated 47df67757a64 as xpnwykqz 54cc0161 a2
|
|
|
|
Rebased 1 commits onto duplicated commits
|
|
|
|
"#);
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ b08d6199fab9 a4
|
|
|
|
│ ├─╮
|
|
|
|
│ │ ○ 54cc0161a5db a2
|
|
|
|
│ ○ │ 17072aa2b823 a3
|
|
|
|
│ ○ │ 47df67757a64 a2
|
|
|
|
│ ├─╯
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits without a direct ancestry relationship between
|
|
|
|
// commits without a direct relationship.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "b1", "--after", "c1", "--before", "d2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as sryyqqkq 44f57f24 a1
|
|
|
|
Duplicated dcc98bc8bbea as pxnqtknr bcee4b60 b1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
Working copy now at: nmzmmopx 6a5a099f d2 | d2
|
2024-06-01 18:39:22 +00:00
|
|
|
Parent commit : xznxytkn 0f21c5e1 d1 | d1
|
2024-11-19 08:22:54 +00:00
|
|
|
Parent commit : sryyqqkq 44f57f24 a1
|
|
|
|
Parent commit : pxnqtknr bcee4b60 b1
|
|
|
|
Added 3 files, modified 0 files, removed 0 files
|
|
|
|
");
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 6a5a099f8a03 d2
|
2024-06-01 18:39:22 +00:00
|
|
|
├─┬─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ ○ bcee4b6058e4 b1
|
|
|
|
│ ○ │ 44f57f247bf2 a1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ├─╯
|
|
|
|
○ │ 0f21c5e185c5 d1
|
|
|
|
│ │ ○ 09560d60cac4 c2
|
|
|
|
│ ├─╯
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits without a direct ancestry relationship between a
|
|
|
|
// commit which is an ancestor of one of the duplicated commits and a commit
|
|
|
|
// with no direct relationship.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a3", "b1", "--after", "a2", "--before", "c2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Duplicated 17072aa2b823 as pyoswmwk 0d11d466 a3
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated dcc98bc8bbea as yqnpwwmq c32d1ccc b1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 9feaad4c40f3 c2
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─┬─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ │ ○ c32d1ccc8d5b b1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ │ ○ │ 0d11d4667aa9 a3
|
|
|
|
│ │ ├─╯
|
|
|
|
│ ○ │ b27346e9a9bd c1
|
|
|
|
├─╯ │
|
|
|
|
│ ○ │ 7b44470918f4 b2
|
|
|
|
│ ○ │ dcc98bc8bbea b1
|
|
|
|
├─╯ │
|
|
|
|
│ ○ │ 196bc1f0efc1 a4
|
|
|
|
│ ○ │ 17072aa2b823 a3
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ├─╯
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits without a direct ancestry relationship between a
|
|
|
|
// commit which is a descendant of one of the duplicated commits and a
|
|
|
|
// commit with no direct relationship.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "b1", "--after", "a3", "--before", "c2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 9e85a474f005 as a descendant of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 9e85a474f005 as tpmlxquz 213aff50 (empty) a1
|
|
|
|
Duplicated dcc98bc8bbea as uukzylyy 67b82bab b1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 7c6622beae40 c2
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─┬─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ │ ○ 67b82babd5f6 b1
|
|
|
|
│ │ ○ │ 213aff50a82b a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ │ ├─╯
|
|
|
|
│ ○ │ b27346e9a9bd c1
|
|
|
|
├─╯ │
|
|
|
|
│ ○ │ 7b44470918f4 b2
|
|
|
|
│ ○ │ dcc98bc8bbea b1
|
|
|
|
├─╯ │
|
|
|
|
│ ○ │ 196bc1f0efc1 a4
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ├─╯
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits without a direct ancestry relationship between
|
|
|
|
// commits without a direct relationship to the duplicated commits.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "b1", "--after", "c1", "--before", "d2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as knltnxnu a2d38733 a1
|
|
|
|
Duplicated dcc98bc8bbea as krtqozmx 2512c935 b1
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
Working copy now at: nmzmmopx 4678ad48 d2 | d2
|
2024-06-01 18:39:22 +00:00
|
|
|
Parent commit : xznxytkn 0f21c5e1 d1 | d1
|
2024-11-19 08:22:54 +00:00
|
|
|
Parent commit : knltnxnu a2d38733 a1
|
|
|
|
Parent commit : krtqozmx 2512c935 b1
|
|
|
|
Added 3 files, modified 0 files, removed 0 files
|
|
|
|
");
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 4678ad489eeb d2
|
2024-06-01 18:39:22 +00:00
|
|
|
├─┬─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ ○ 2512c9358cb7 b1
|
|
|
|
│ ○ │ a2d387331978 a1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ├─╯
|
|
|
|
○ │ 0f21c5e185c5 d1
|
|
|
|
│ │ ○ 09560d60cac4 c2
|
|
|
|
│ ├─╯
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship between
|
|
|
|
// commits without a direct relationship to the duplicated commits.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "a3", "--after", "c1", "--before", "d2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as wxzmtyol 893a647a a1
|
|
|
|
Duplicated 17072aa2b823 as musouqkq fb14bc1e a3
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
Working copy now at: nmzmmopx 21321795 d2 | d2
|
2024-06-01 18:39:22 +00:00
|
|
|
Parent commit : xznxytkn 0f21c5e1 d1 | d1
|
2024-11-19 08:22:54 +00:00
|
|
|
Parent commit : musouqkq fb14bc1e a3
|
2024-06-01 18:39:22 +00:00
|
|
|
Added 3 files, modified 0 files, removed 0 files
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 21321795f72f d2
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ fb14bc1e2c3c a3
|
|
|
|
│ ○ 893a647a7f64 a1
|
2024-06-01 18:39:22 +00:00
|
|
|
○ │ 0f21c5e185c5 d1
|
|
|
|
│ │ ○ 09560d60cac4 c2
|
|
|
|
│ ├─╯
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
│ ○ 196bc1f0efc1 a4
|
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship between a commit
|
|
|
|
// which is an ancestor of one of the duplicated commits and a commit
|
|
|
|
// without a direct relationship.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a3", "a4", "--after", "a2", "--before", "c2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r#"
|
|
|
|
Duplicated 17072aa2b823 as quyylypw d4d3c907 a3
|
|
|
|
Duplicated 196bc1f0efc1 as prukwozq 96798f1b a4
|
|
|
|
Rebased 1 commits onto duplicated commits
|
|
|
|
"#);
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
|
|
|
│ ○ 267f3c6f05a2 c2
|
|
|
|
│ ├─╮
|
|
|
|
│ │ ○ 96798f1b59fc a4
|
|
|
|
│ │ ○ d4d3c9073a3b a3
|
|
|
|
│ ○ │ b27346e9a9bd c1
|
|
|
|
├─╯ │
|
|
|
|
│ ○ │ 7b44470918f4 b2
|
|
|
|
│ ○ │ dcc98bc8bbea b1
|
|
|
|
├─╯ │
|
|
|
|
│ ○ │ 196bc1f0efc1 a4
|
|
|
|
│ ○ │ 17072aa2b823 a3
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ├─╯
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship between a commit
|
|
|
|
// which is a a descendant of one of the duplicated commits and a commit
|
|
|
|
// with no direct relationship.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "a2", "--before", "a3", "--after", "c2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
|
|
|
Duplicated 9e85a474f005 as vvvtksvt b44d23b4 a1
|
|
|
|
Duplicated 47df67757a64 as yvrnrpnw 4d0d41e2 a2
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 2 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 1ed8f9907f23 a4
|
|
|
|
│ ○ c48cf7ac619c a3
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ├─╮
|
2024-11-19 08:22:54 +00:00
|
|
|
│ │ ○ 4d0d41e2b74e a2
|
|
|
|
│ │ ○ b44d23b4c98e a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ │ ○ 09560d60cac4 c2
|
|
|
|
│ │ ○ b27346e9a9bd c1
|
|
|
|
├───╯
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
2024-06-01 18:39:22 +00:00
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship between descendant
|
|
|
|
// commits.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a3", "a4", "--after", "a1", "--before", "a2"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 196bc1f0efc1 as an ancestor of itself
|
|
|
|
Warning: Duplicating commit 17072aa2b823 as an ancestor of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 17072aa2b823 as sukptuzs 8678104c a3
|
|
|
|
Duplicated 196bc1f0efc1 as rxnrppxl b6580274 a4
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 3 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 795c1625854d a4
|
|
|
|
│ ○ c3fbe644a16b a3
|
|
|
|
│ ○ af75098c676a a2
|
|
|
|
│ ○ b6580274470b a4
|
|
|
|
│ ○ 8678104c14af a3
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship between ancestor
|
|
|
|
// commits.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "a2", "--after", "a3", "--before", "a4"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-19 08:22:54 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r"
|
2024-06-01 18:39:22 +00:00
|
|
|
Warning: Duplicating commit 47df67757a64 as a descendant of itself
|
|
|
|
Warning: Duplicating commit 9e85a474f005 as a descendant of itself
|
2024-11-19 08:22:54 +00:00
|
|
|
Duplicated 9e85a474f005 as rwkyzntp b68b9a00 (empty) a1
|
|
|
|
Duplicated 47df67757a64 as nqtyztop 0dd00ded (empty) a2
|
2024-06-01 18:39:22 +00:00
|
|
|
Rebased 1 commits onto duplicated commits
|
2024-11-19 08:22:54 +00:00
|
|
|
");
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
2024-11-19 08:22:54 +00:00
|
|
|
│ ○ 4f02390e56aa a4
|
|
|
|
│ ○ 0dd00dedd0c5 a2
|
|
|
|
│ ○ b68b9a0073cb a1
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ 17072aa2b823 a3
|
|
|
|
│ ○ 47df67757a64 a2
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Duplicate multiple commits with an ancestry relationship between an ancestor
|
|
|
|
// commit and a descendant commit.
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a2", "a3", "--after", "a1", "--before", "a4"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r#"
|
|
|
|
Duplicated 47df67757a64 as nwmqwkzz 8517eaa7 a2
|
|
|
|
Duplicated 17072aa2b823 as uwrrnrtx 3ce18231 a3
|
|
|
|
Rebased 1 commits onto duplicated commits
|
|
|
|
"#);
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r"
|
|
|
|
@ 0cdd923e993a d2
|
|
|
|
○ 0f21c5e185c5 d1
|
2024-06-01 18:39:22 +00:00
|
|
|
│ ○ 09560d60cac4 c2
|
|
|
|
│ ○ b27346e9a9bd c1
|
|
|
|
├─╯
|
|
|
|
│ ○ 7b44470918f4 b2
|
|
|
|
│ ○ dcc98bc8bbea b1
|
|
|
|
├─╯
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ 0855137fa398 a4
|
|
|
|
│ ├─╮
|
|
|
|
│ │ ○ 3ce182317a5b a3
|
|
|
|
│ │ ○ 8517eaa73536 a2
|
|
|
|
│ ○ │ 17072aa2b823 a3
|
|
|
|
│ ○ │ 47df67757a64 a2
|
|
|
|
│ ├─╯
|
|
|
|
│ ○ 9e85a474f005 a1
|
|
|
|
├─╯
|
2024-06-01 18:39:22 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
");
|
2024-06-01 18:39:22 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
|
|
|
|
|
|
|
|
// Should error if a loop will be created.
|
|
|
|
let stderr = test_env.jj_cmd_failure(
|
|
|
|
&repo_path,
|
|
|
|
&["duplicate", "a1", "--after", "b2", "--before", "b1"],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stderr, @r#"
|
|
|
|
Error: Refusing to create a loop: commit 7b44470918f4 would be both an ancestor and a descendant of the duplicated commits
|
|
|
|
"#);
|
|
|
|
}
|
|
|
|
|
2023-01-16 19:22:10 +00:00
|
|
|
// https://github.com/martinvonz/jj/issues/1050
|
|
|
|
#[test]
|
|
|
|
fn test_undo_after_duplicate() {
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2023-01-16 19:22:10 +00:00
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
create_commit(&test_env, &repo_path, "a", &[]);
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
@ 2443ea76b0b1 a
|
2024-07-15 22:20:10 +00:00
|
|
|
◆ 000000000000
|
2023-01-16 19:22:10 +00:00
|
|
|
"###);
|
|
|
|
|
2023-10-10 11:59:18 +00:00
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a"]);
|
2023-10-10 11:07:06 +00:00
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2023-07-11 01:46:38 +00:00
|
|
|
Duplicated 2443ea76b0b1 as mzvwutvl f5cefcbb a
|
2023-01-16 19:22:10 +00:00
|
|
|
"###);
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#"
|
|
|
|
@ 2443ea76b0b1 a
|
|
|
|
│ ○ f5cefcbb65a4 a
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
◆ 000000000000
|
2024-09-21 06:01:33 +00:00
|
|
|
"#);
|
2023-01-16 19:22:10 +00:00
|
|
|
|
2023-10-10 11:59:18 +00:00
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-09-12 14:20:57 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r#"
|
2024-10-07 03:00:49 +00:00
|
|
|
Undid operation: e3dbefa46ed5 (2001-02-03 08:05:11) duplicate 1 commit(s)
|
2024-09-12 14:20:57 +00:00
|
|
|
"#);
|
2023-01-16 19:22:10 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
2023-02-09 02:53:47 +00:00
|
|
|
@ 2443ea76b0b1 a
|
2024-07-15 22:20:10 +00:00
|
|
|
◆ 000000000000
|
2023-01-16 19:22:10 +00:00
|
|
|
"###);
|
|
|
|
}
|
|
|
|
|
2023-01-15 06:08:13 +00:00
|
|
|
// https://github.com/martinvonz/jj/issues/694
|
|
|
|
#[test]
|
|
|
|
fn test_rebase_duplicates() {
|
|
|
|
let test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2023-01-15 06:08:13 +00:00
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
create_commit(&test_env, &repo_path, "a", &[]);
|
|
|
|
create_commit(&test_env, &repo_path, "b", &["a"]);
|
2024-03-25 11:46:10 +00:00
|
|
|
create_commit(&test_env, &repo_path, "c", &["b"]);
|
2023-01-15 06:08:13 +00:00
|
|
|
// Test the setup
|
|
|
|
insta::assert_snapshot!(get_log_output_with_ts(&test_env, &repo_path), @r###"
|
2024-03-25 11:46:10 +00:00
|
|
|
@ 7e4fbf4f2759 c @ 2001-02-03 04:05:13.000 +07:00
|
2024-07-15 22:20:10 +00:00
|
|
|
○ 1394f625cbbd b @ 2001-02-03 04:05:11.000 +07:00
|
|
|
|
○ 2443ea76b0b1 a @ 2001-02-03 04:05:09.000 +07:00
|
|
|
|
◆ 000000000000 @ 1970-01-01 00:00:00.000 +00:00
|
2023-01-15 06:08:13 +00:00
|
|
|
"###);
|
|
|
|
|
2024-03-25 11:46:10 +00:00
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "c"]);
|
2023-10-10 11:07:06 +00:00
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2024-03-25 11:46:10 +00:00
|
|
|
Duplicated 7e4fbf4f2759 as yostqsxw 0ac2063b c
|
2023-01-15 06:08:13 +00:00
|
|
|
"###);
|
2024-03-25 11:46:10 +00:00
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "c"]);
|
2023-10-10 11:07:06 +00:00
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2024-03-25 11:46:10 +00:00
|
|
|
Duplicated 7e4fbf4f2759 as znkkpsqq ce5f4eeb c
|
2023-01-15 06:08:13 +00:00
|
|
|
"###);
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output_with_ts(&test_env, &repo_path), @r#"
|
|
|
|
@ 7e4fbf4f2759 c @ 2001-02-03 04:05:13.000 +07:00
|
|
|
|
│ ○ ce5f4eeb69d1 c @ 2001-02-03 04:05:16.000 +07:00
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╯
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ 0ac2063b1bee c @ 2001-02-03 04:05:15.000 +07:00
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
○ 1394f625cbbd b @ 2001-02-03 04:05:11.000 +07:00
|
|
|
|
○ 2443ea76b0b1 a @ 2001-02-03 04:05:09.000 +07:00
|
|
|
|
◆ 000000000000 @ 1970-01-01 00:00:00.000 +00:00
|
2024-09-21 06:01:33 +00:00
|
|
|
"#);
|
2023-01-15 06:08:13 +00:00
|
|
|
|
2024-03-25 11:46:10 +00:00
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["rebase", "-s", "b", "-d", "root()"]);
|
2023-10-10 11:07:06 +00:00
|
|
|
insta::assert_snapshot!(stdout, @"");
|
2024-11-11 12:43:52 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r#"
|
|
|
|
Rebased 4 commits onto destination
|
2024-03-25 11:46:10 +00:00
|
|
|
Working copy now at: royxmykx ed671a3c c | c
|
|
|
|
Parent commit : zsuskuln 4c6f1569 b | b
|
|
|
|
Added 0 files, modified 0 files, removed 1 files
|
2024-11-11 12:43:52 +00:00
|
|
|
"#);
|
2023-01-15 07:28:36 +00:00
|
|
|
// Some of the duplicate commits' timestamps were changed a little to make them
|
|
|
|
// have distinct commit ids.
|
2024-09-21 06:01:33 +00:00
|
|
|
insta::assert_snapshot!(get_log_output_with_ts(&test_env, &repo_path), @r#"
|
|
|
|
@ ed671a3cbf35 c @ 2001-02-03 04:05:18.000 +07:00
|
|
|
|
│ ○ b86e9f27d085 c @ 2001-02-03 04:05:16.000 +07:00
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╯
|
2024-09-21 06:01:33 +00:00
|
|
|
│ ○ 8033590fe04d c @ 2001-02-03 04:05:17.000 +07:00
|
2024-03-25 11:46:10 +00:00
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
○ 4c6f1569e2a9 b @ 2001-02-03 04:05:18.000 +07:00
|
|
|
|
│ ○ 2443ea76b0b1 a @ 2001-02-03 04:05:09.000 +07:00
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╯
|
2024-07-15 22:20:10 +00:00
|
|
|
◆ 000000000000 @ 1970-01-01 00:00:00.000 +00:00
|
2024-09-21 06:01:33 +00:00
|
|
|
"#);
|
2023-01-15 06:08:13 +00:00
|
|
|
}
|
|
|
|
|
2023-01-16 19:22:10 +00:00
|
|
|
fn get_log_output(test_env: &TestEnvironment, repo_path: &Path) -> String {
|
2023-02-28 11:30:57 +00:00
|
|
|
let template = r#"commit_id.short() ++ " " ++ description.first_line()"#;
|
2023-02-28 10:43:14 +00:00
|
|
|
test_env.jj_cmd_success(repo_path, &["log", "-T", template])
|
2023-01-16 19:22:10 +00:00
|
|
|
}
|
2023-01-15 06:08:13 +00:00
|
|
|
|
|
|
|
fn get_log_output_with_ts(test_env: &TestEnvironment, repo_path: &Path) -> String {
|
2023-08-15 03:18:52 +00:00
|
|
|
let template = r#"
|
2023-02-28 11:30:57 +00:00
|
|
|
commit_id.short() ++ " " ++ description.first_line() ++ " @ " ++ committer.timestamp()
|
2023-08-15 03:18:52 +00:00
|
|
|
"#;
|
2023-02-28 10:43:14 +00:00
|
|
|
test_env.jj_cmd_success(repo_path, &["log", "-T", template])
|
2023-01-15 06:08:13 +00:00
|
|
|
}
|