2022-11-26 23:57:50 +00:00
|
|
|
// Copyright 2022 The Jujutsu Authors
|
2022-05-29 06:05:30 +00:00
|
|
|
//
|
|
|
|
// 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;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_unsquash() {
|
|
|
|
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"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["branch", "create", "a"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
std::fs::write(repo_path.join("file1"), "a\n").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new"]);
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["branch", "create", "b"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
std::fs::write(repo_path.join("file1"), "b\n").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new"]);
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["branch", "create", "c"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
std::fs::write(repo_path.join("file1"), "c\n").unwrap();
|
|
|
|
// Test the setup
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
@ 382c9bad7d42 c
|
|
|
|
◉ d5d59175b481 b
|
|
|
|
◉ 184ddbcce5a9 a
|
2023-03-15 03:37:56 +00:00
|
|
|
◉ 000000000000
|
2022-05-29 06:05:30 +00:00
|
|
|
"###);
|
|
|
|
|
|
|
|
// Unsquashes into the working copy from its parent by default
|
2023-10-10 11:59:18 +00:00
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["unsquash"]);
|
2023-10-10 11:07:06 +00:00
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
Working copy now at: mzvwutvl 9177132c c | (no description set)
|
|
|
|
Parent commit : qpvuntsm 184ddbcc a b | (no description set)
|
2022-05-29 06:05:30 +00:00
|
|
|
"###);
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
@ 9177132cfbb9 c
|
|
|
|
◉ 184ddbcce5a9 a b
|
2023-03-15 03:37:56 +00:00
|
|
|
◉ 000000000000
|
2022-05-29 06:05:30 +00:00
|
|
|
"###);
|
2024-06-26 01:17:11 +00:00
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
c
|
|
|
|
"###);
|
|
|
|
|
|
|
|
// Can unsquash into a given commit from its parent
|
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, &["unsquash", "-r", "b"]);
|
2023-10-10 11:07:06 +00:00
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2022-05-29 06:05:30 +00:00
|
|
|
Rebased 1 descendant commits
|
2024-06-23 22:20:33 +00:00
|
|
|
Working copy now at: mzvwutvl b353b29c c | (no description set)
|
|
|
|
Parent commit : kkmpptxz 27772b15 b | (no description set)
|
2022-05-29 06:05:30 +00:00
|
|
|
"###);
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
@ b353b29c423d c
|
|
|
|
◉ 27772b156771 b
|
2023-03-15 03:37:56 +00:00
|
|
|
◉ 000000000000 a
|
2022-05-29 06:05:30 +00:00
|
|
|
"###);
|
2024-06-26 01:17:11 +00:00
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "b"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
b
|
|
|
|
"###);
|
2024-06-26 01:17:11 +00:00
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
c
|
|
|
|
"###);
|
|
|
|
|
|
|
|
// Cannot unsquash into a merge commit (because it's unclear which parent it
|
|
|
|
// should come from)
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["edit", "b"]);
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new"]);
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["branch", "create", "d"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
std::fs::write(repo_path.join("file2"), "d\n").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "merge", "c", "d"]);
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["branch", "create", "e"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
@ b780e7469252 e
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╮
|
2024-06-23 22:20:33 +00:00
|
|
|
│ ◉ f86e2b3af3e3 d
|
|
|
|
◉ │ 382c9bad7d42 c
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╯
|
2024-06-23 22:20:33 +00:00
|
|
|
◉ d5d59175b481 b
|
|
|
|
◉ 184ddbcce5a9 a
|
2023-03-15 03:37:56 +00:00
|
|
|
◉ 000000000000
|
2022-05-29 06:05:30 +00:00
|
|
|
"###);
|
2022-08-31 05:39:32 +00:00
|
|
|
let stderr = test_env.jj_cmd_failure(&repo_path, &["unsquash"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
|
|
|
Error: Cannot unsquash merge commits
|
|
|
|
"###);
|
|
|
|
|
|
|
|
// Can unsquash from a merge commit
|
2024-03-05 05:26:31 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new", "e"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
std::fs::write(repo_path.join("file1"), "e\n").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["unsquash"]);
|
2023-10-10 11:07:06 +00:00
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
Working copy now at: pzsxstzt bd05eb69 merge
|
|
|
|
Parent commit : mzvwutvl 382c9bad c e?? | (no description set)
|
|
|
|
Parent commit : xznxytkn f86e2b3a d e?? | (no description set)
|
2022-05-29 06:05:30 +00:00
|
|
|
"###);
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
@ bd05eb698d1e
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╮
|
2024-06-23 22:20:33 +00:00
|
|
|
│ ◉ f86e2b3af3e3 d e??
|
|
|
|
◉ │ 382c9bad7d42 c e??
|
2023-02-09 02:53:47 +00:00
|
|
|
├─╯
|
2024-06-23 22:20:33 +00:00
|
|
|
◉ d5d59175b481 b
|
|
|
|
◉ 184ddbcce5a9 a
|
2023-03-15 03:37:56 +00:00
|
|
|
◉ 000000000000
|
2022-05-29 06:05:30 +00:00
|
|
|
"###);
|
2024-06-26 01:17:11 +00:00
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
e
|
|
|
|
"###);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_unsquash_partial() {
|
|
|
|
let mut test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["branch", "create", "a"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
std::fs::write(repo_path.join("file1"), "a\n").unwrap();
|
|
|
|
std::fs::write(repo_path.join("file2"), "a\n").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new"]);
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["branch", "create", "b"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
std::fs::write(repo_path.join("file1"), "b\n").unwrap();
|
|
|
|
std::fs::write(repo_path.join("file2"), "b\n").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new"]);
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["branch", "create", "c"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
std::fs::write(repo_path.join("file1"), "c\n").unwrap();
|
|
|
|
std::fs::write(repo_path.join("file2"), "c\n").unwrap();
|
|
|
|
// Test the setup
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
@ a0b1a272ebc4 c
|
|
|
|
◉ d117da276a0f b
|
|
|
|
◉ 54d3c1c0e9fd a
|
2023-03-15 03:37:56 +00:00
|
|
|
◉ 000000000000
|
2022-05-29 06:05:30 +00:00
|
|
|
"###);
|
|
|
|
|
|
|
|
// If we don't make any changes in the diff-editor, the whole change is moved
|
|
|
|
// from the parent
|
|
|
|
let edit_script = test_env.set_up_fake_diff_editor();
|
2023-10-10 11:59:18 +00:00
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["unsquash", "-r", "b", "-i"]);
|
2023-10-10 11:07:06 +00:00
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2022-05-29 06:05:30 +00:00
|
|
|
Rebased 1 descendant commits
|
2024-06-23 22:20:33 +00:00
|
|
|
Working copy now at: mzvwutvl 8802263d c | (no description set)
|
|
|
|
Parent commit : kkmpptxz 5bd83140 b | (no description set)
|
2022-05-29 06:05:30 +00:00
|
|
|
"###);
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
@ 8802263dbd92 c
|
|
|
|
◉ 5bd83140fd47 b
|
|
|
|
◉ c93de9257191 a
|
2023-03-15 03:37:56 +00:00
|
|
|
◉ 000000000000
|
2022-05-29 06:05:30 +00:00
|
|
|
"###);
|
2024-06-26 01:17:11 +00:00
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "a"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
a
|
|
|
|
"###);
|
|
|
|
|
|
|
|
// Can unsquash only some changes in interactive mode
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
2023-01-26 05:14:55 +00:00
|
|
|
std::fs::write(edit_script, "reset file1").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["unsquash", "-i"]);
|
2023-10-10 11:07:06 +00:00
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
Working copy now at: mzvwutvl a896ffde c | (no description set)
|
|
|
|
Parent commit : kkmpptxz 904111b4 b | (no description set)
|
2022-05-29 06:05:30 +00:00
|
|
|
"###);
|
|
|
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
@ a896ffdebb85 c
|
|
|
|
◉ 904111b4d3c4 b
|
|
|
|
◉ 54d3c1c0e9fd a
|
2023-03-15 03:37:56 +00:00
|
|
|
◉ 000000000000
|
2022-05-29 06:05:30 +00:00
|
|
|
"###);
|
2024-06-26 01:17:11 +00:00
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "b"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
a
|
|
|
|
"###);
|
2024-06-26 01:17:11 +00:00
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2", "-r", "b"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
b
|
|
|
|
"###);
|
2024-06-26 01:17:11 +00:00
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "c"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
c
|
|
|
|
"###);
|
2024-06-26 01:17:11 +00:00
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2", "-r", "c"]);
|
2022-05-29 06:05:30 +00:00
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
c
|
|
|
|
"###);
|
2024-03-01 14:49:22 +00:00
|
|
|
|
|
|
|
// Try again with --tool=<name>, which implies --interactive
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
|
|
|
let (stdout, stderr) = test_env.jj_cmd_ok(
|
|
|
|
&repo_path,
|
|
|
|
&[
|
|
|
|
"unsquash",
|
|
|
|
"--config-toml=ui.diff-editor='false'",
|
|
|
|
"--tool=fake-diff-editor",
|
|
|
|
],
|
|
|
|
);
|
|
|
|
insta::assert_snapshot!(stdout, @"");
|
|
|
|
insta::assert_snapshot!(stderr, @r###"
|
2024-06-23 22:20:33 +00:00
|
|
|
Working copy now at: mzvwutvl aaca9268 c | (no description set)
|
|
|
|
Parent commit : kkmpptxz fe8eb117 b | (no description set)
|
2024-03-01 14:49:22 +00:00
|
|
|
"###);
|
2024-06-26 01:17:11 +00:00
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "b"]);
|
2024-03-01 14:49:22 +00:00
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
a
|
|
|
|
"###);
|
2024-06-26 01:17:11 +00:00
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2", "-r", "b"]);
|
2024-03-01 14:49:22 +00:00
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
b
|
|
|
|
"###);
|
2024-06-26 01:17:11 +00:00
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "c"]);
|
2024-03-01 14:49:22 +00:00
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
c
|
|
|
|
"###);
|
2024-06-26 01:17:11 +00:00
|
|
|
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2", "-r", "c"]);
|
2024-03-01 14:49:22 +00:00
|
|
|
insta::assert_snapshot!(stdout, @r###"
|
|
|
|
c
|
|
|
|
"###);
|
2022-05-29 06:05:30 +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() ++ " " ++ branches"#;
|
2023-02-28 10:43:14 +00:00
|
|
|
test_env.jj_cmd_success(repo_path, &["log", "-T", template])
|
2022-05-29 06:05:30 +00:00
|
|
|
}
|
2022-08-28 17:28:53 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_unsquash_description() {
|
|
|
|
let mut test_env = TestEnvironment::default();
|
2024-05-17 19:49:25 +00:00
|
|
|
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
2022-08-28 17:28:53 +00:00
|
|
|
let repo_path = test_env.env_root().join("repo");
|
|
|
|
|
|
|
|
let edit_script = test_env.set_up_fake_editor();
|
2022-12-21 04:33:21 +00:00
|
|
|
std::fs::write(&edit_script, r#"fail"#).unwrap();
|
2022-08-28 17:28:53 +00:00
|
|
|
|
|
|
|
// If both descriptions are empty, the resulting description is empty
|
|
|
|
std::fs::write(repo_path.join("file1"), "a\n").unwrap();
|
|
|
|
std::fs::write(repo_path.join("file2"), "a\n").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["new"]);
|
2022-08-28 17:28:53 +00:00
|
|
|
std::fs::write(repo_path.join("file1"), "b\n").unwrap();
|
|
|
|
std::fs::write(repo_path.join("file2"), "b\n").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["unsquash"]);
|
2023-01-31 09:17:46 +00:00
|
|
|
insta::assert_snapshot!(get_description(&test_env, &repo_path, "@"), @"");
|
2022-08-28 17:28:53 +00:00
|
|
|
|
|
|
|
// If the destination's description is empty and the source's description is
|
|
|
|
// non-empty, the resulting description is from the source
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["describe", "@-", "-m", "source"]);
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["unsquash"]);
|
2022-08-28 17:28:53 +00:00
|
|
|
insta::assert_snapshot!(get_description(&test_env, &repo_path, "@"), @r###"
|
|
|
|
source
|
|
|
|
"###);
|
|
|
|
|
|
|
|
// If the destination description is non-empty and the source's description is
|
|
|
|
// empty, the resulting description is from the destination
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["op", "restore", "@--"]);
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "destination"]);
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["unsquash"]);
|
2022-08-28 17:28:53 +00:00
|
|
|
insta::assert_snapshot!(get_description(&test_env, &repo_path, "@"), @r###"
|
|
|
|
destination
|
|
|
|
"###);
|
|
|
|
|
|
|
|
// If both descriptions were non-empty, we get asked for a combined description
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
|
|
|
test_env.jj_cmd_ok(&repo_path, &["describe", "@-", "-m", "source"]);
|
2022-12-22 07:58:23 +00:00
|
|
|
std::fs::write(&edit_script, "dump editor0").unwrap();
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["unsquash"]);
|
2022-08-28 17:28:53 +00:00
|
|
|
insta::assert_snapshot!(get_description(&test_env, &repo_path, "@"), @r###"
|
|
|
|
destination
|
2022-12-21 04:47:10 +00:00
|
|
|
|
2022-08-28 17:28:53 +00:00
|
|
|
source
|
|
|
|
"###);
|
2022-12-22 07:58:23 +00:00
|
|
|
insta::assert_snapshot!(
|
|
|
|
std::fs::read_to_string(test_env.env_root().join("editor0")).unwrap(), @r###"
|
|
|
|
JJ: Enter a description for the combined commit.
|
|
|
|
JJ: Description from the destination commit:
|
|
|
|
destination
|
|
|
|
|
2024-03-11 16:30:56 +00:00
|
|
|
JJ: Description from source commit:
|
2022-12-22 07:58:23 +00:00
|
|
|
source
|
|
|
|
|
|
|
|
JJ: Lines starting with "JJ: " (like this one) will be removed.
|
|
|
|
"###);
|
2022-08-28 17:28:53 +00:00
|
|
|
|
|
|
|
// If the source's *content* doesn't become empty, then the source remains and
|
|
|
|
// both descriptions are unchanged
|
2023-10-10 11:59:18 +00:00
|
|
|
test_env.jj_cmd_ok(&repo_path, &["undo"]);
|
2022-08-28 17:28:53 +00:00
|
|
|
insta::assert_snapshot!(get_description(&test_env, &repo_path, "@-"), @r###"
|
|
|
|
source
|
|
|
|
"###);
|
|
|
|
insta::assert_snapshot!(get_description(&test_env, &repo_path, "@"), @r###"
|
|
|
|
destination
|
|
|
|
"###);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_description(test_env: &TestEnvironment, repo_path: &Path, rev: &str) -> String {
|
|
|
|
test_env.jj_cmd_success(
|
|
|
|
repo_path,
|
|
|
|
&["log", "--no-graph", "-T", "description", "-r", rev],
|
|
|
|
)
|
|
|
|
}
|