From 5c6f82ec7bfe3ebdc4012f9fe89f6ca9817aa3a2 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Sat, 21 May 2022 11:20:51 -0700 Subject: [PATCH] tests: remove `&UserSettings` argument from `TestRepo::init()` We don't even have any settings that affect the repo, so there's no point in passing the settings. I think this was a leftover from before we separated out the "workspace" concept; now we no longer create a working-copy commit when we initialize a repo (we do that when we attach the workspace). --- lib/src/testutils.rs | 7 +-- lib/tests/test_commit_builder.rs | 6 +-- lib/tests/test_conflicts.rs | 12 ++--- lib/tests/test_diff_summary.rs | 15 ++---- lib/tests/test_git.rs | 6 +-- lib/tests/test_index.rs | 29 ++++++------ lib/tests/test_load_repo.rs | 2 +- lib/tests/test_merge_trees.rs | 20 +++----- lib/tests/test_mut_repo.rs | 34 ++++++------- lib/tests/test_operations.rs | 8 ++-- lib/tests/test_revset.rs | 63 ++++++++++++------------- lib/tests/test_revset_graph_iterator.rs | 14 +++--- lib/tests/test_rewrite.rs | 58 +++++++++++------------ lib/tests/test_view.rs | 23 +++++---- 14 files changed, 139 insertions(+), 158 deletions(-) diff --git a/lib/src/testutils.rs b/lib/src/testutils.rs index bd76dc98d..bd71e30e1 100644 --- a/lib/src/testutils.rs +++ b/lib/src/testutils.rs @@ -58,7 +58,8 @@ pub struct TestRepo { } impl TestRepo { - pub fn init(settings: &UserSettings, use_git: bool) -> Self { + pub fn init(use_git: bool) -> Self { + let settings = user_settings(); let temp_dir = tempfile::tempdir().unwrap(); let repo_dir = temp_dir.path().join("repo"); @@ -67,9 +68,9 @@ impl TestRepo { let repo = if use_git { let git_path = temp_dir.path().join("git-repo"); git2::Repository::init(&git_path).unwrap(); - ReadonlyRepo::init_external_git(settings, repo_dir, git_path) + ReadonlyRepo::init_external_git(&settings, repo_dir, git_path) } else { - ReadonlyRepo::init_local(settings, repo_dir) + ReadonlyRepo::init_local(&settings, repo_dir) }; Self { diff --git a/lib/tests/test_commit_builder.rs b/lib/tests/test_commit_builder.rs index 4e2281437..607e39b79 100644 --- a/lib/tests/test_commit_builder.rs +++ b/lib/tests/test_commit_builder.rs @@ -25,7 +25,7 @@ use test_case::test_case; #[test_case(true ; "git backend")] fn test_initial(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let store = repo.store(); @@ -70,7 +70,7 @@ fn test_initial(use_git: bool) { #[test_case(true ; "git backend")] fn test_rewrite(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let store = repo.store().clone(); @@ -157,7 +157,7 @@ fn test_rewrite(use_git: bool) { // #[test_case(true ; "git backend")] fn test_commit_builder_descendants(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let store = repo.store().clone(); diff --git a/lib/tests/test_conflicts.rs b/lib/tests/test_conflicts.rs index e2ca4e188..d779f3451 100644 --- a/lib/tests/test_conflicts.rs +++ b/lib/tests/test_conflicts.rs @@ -21,8 +21,7 @@ use jujutsu_lib::testutils::TestRepo; #[test] fn test_materialize_conflict_basic() { - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let store = test_repo.repo.store(); let path = RepoPath::from_internal_string("file"); @@ -101,8 +100,7 @@ line 5 #[test] fn test_materialize_conflict_modify_delete() { - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let store = test_repo.repo.store(); let path = RepoPath::from_internal_string("file"); @@ -179,8 +177,7 @@ line 5 #[test] fn test_materialize_conflict_delete_modify() { - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let store = test_repo.repo.store(); let path = RepoPath::from_internal_string("file"); @@ -423,8 +420,7 @@ line 5 #[test] fn test_update_conflict_from_content() { - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let store = test_repo.repo.store(); let path = RepoPath::from_internal_string("dir/file"); diff --git a/lib/tests/test_diff_summary.rs b/lib/tests/test_diff_summary.rs index e45d471e2..c6edf68ac 100644 --- a/lib/tests/test_diff_summary.rs +++ b/lib/tests/test_diff_summary.rs @@ -23,8 +23,7 @@ use test_case::test_case; #[test_case(false ; "local backend")] #[test_case(true ; "git backend")] fn test_types(use_git: bool) { - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let clean_path = RepoPath::from_internal_string("clean"); @@ -63,8 +62,7 @@ fn test_types(use_git: bool) { #[test_case(false ; "local backend")] #[test_case(true ; "git backend")] fn test_tree_file_transition(use_git: bool) { - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let dir_file_path = RepoPath::from_internal_string("dir/file"); @@ -94,8 +92,7 @@ fn test_tree_file_transition(use_git: bool) { #[test_case(false ; "local backend")] #[test_case(true ; "git backend")] fn test_sorting(use_git: bool) { - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let a_path = RepoPath::from_internal_string("a"); @@ -160,8 +157,7 @@ fn test_sorting(use_git: bool) { #[test_case(false ; "local backend")] #[test_case(true ; "git backend")] fn test_matcher_dir_file_transition(use_git: bool) { - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let a_path = RepoPath::from_internal_string("a"); @@ -228,8 +224,7 @@ fn test_matcher_dir_file_transition(use_git: bool) { #[test_case(false ; "local backend")] #[test_case(true ; "git backend")] fn test_matcher_normal_cases(use_git: bool) { - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let a_path = RepoPath::from_internal_string("a"); diff --git a/lib/tests/test_git.rs b/lib/tests/test_git.rs index 7ba5d1e93..6c7cf2611 100644 --- a/lib/tests/test_git.rs +++ b/lib/tests/test_git.rs @@ -55,7 +55,7 @@ fn commit_id(commit: &git2::Commit) -> CommitId { #[test] fn test_import_refs() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, true); + let test_repo = TestRepo::init(true); let repo = &test_repo.repo; let git_repo = repo.store().git_repo().unwrap(); @@ -144,7 +144,7 @@ fn test_import_refs() { #[test] fn test_import_refs_reimport() { let settings = testutils::user_settings(); - let test_workspace = TestRepo::init(&settings, true); + let test_workspace = TestRepo::init(true); let repo = &test_workspace.repo; let git_repo = repo.store().git_repo().unwrap(); @@ -238,7 +238,7 @@ fn test_import_refs_reimport() { fn test_import_refs_reimport_head_removed() { // Test that re-importing refs doesn't cause a deleted head to come back let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, true); + let test_repo = TestRepo::init(true); let repo = &test_repo.repo; let git_repo = repo.store().git_repo().unwrap(); diff --git a/lib/tests/test_index.rs b/lib/tests/test_index.rs index 30b35bf1f..fa174fdc6 100644 --- a/lib/tests/test_index.rs +++ b/lib/tests/test_index.rs @@ -41,8 +41,7 @@ fn generation_number<'a>(index: impl Into>, commit_id: &CommitId) - #[test_case(false ; "local backend")] #[test_case(true ; "git backend")] fn test_index_commits_empty_repo(use_git: bool) { - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let index = repo.index(); @@ -60,7 +59,7 @@ fn test_index_commits_empty_repo(use_git: bool) { #[test_case(true ; "git backend")] fn test_index_commits_standard_cases(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // o H @@ -128,7 +127,7 @@ fn test_index_commits_standard_cases(use_git: bool) { #[test_case(true ; "git backend")] fn test_index_commits_criss_cross(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let num_generations = 50; @@ -228,7 +227,7 @@ fn test_index_commits_criss_cross(use_git: bool) { fn test_index_commits_previous_operations(use_git: bool) { // Test that commits visible only in previous operations are indexed. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Remove commit B and C in one operation and make sure they're still @@ -276,7 +275,7 @@ fn test_index_commits_previous_operations(use_git: bool) { #[test_case(true ; "git backend")] fn test_index_commits_incremental(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Create A in one operation, then B and C in another. Check that the index is @@ -324,7 +323,7 @@ fn test_index_commits_incremental(use_git: bool) { #[test_case(true ; "git backend")] fn test_index_commits_incremental_empty_transaction(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Create A in one operation, then just an empty transaction. Check that the @@ -366,7 +365,7 @@ fn test_index_commits_incremental_empty_transaction(use_git: bool) { fn test_index_commits_incremental_already_indexed(use_git: bool) { // Tests that trying to add a commit that's already been added is a no-op. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Create A in one operation, then try to add it again an new transaction. @@ -415,24 +414,24 @@ fn commits_by_level(repo: &ReadonlyRepo) -> Vec { fn test_index_commits_incremental_squashed(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let repo = create_n_commits(&settings, repo, 1); assert_eq!(commits_by_level(&repo), vec![2]); let repo = create_n_commits(&settings, &repo, 1); assert_eq!(commits_by_level(&repo), vec![3]); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let repo = create_n_commits(&settings, repo, 2); assert_eq!(commits_by_level(&repo), vec![3]); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let repo = create_n_commits(&settings, repo, 100); assert_eq!(commits_by_level(&repo), vec![101]); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let repo = create_n_commits(&settings, repo, 1); let repo = create_n_commits(&settings, &repo, 2); @@ -442,7 +441,7 @@ fn test_index_commits_incremental_squashed(use_git: bool) { let repo = create_n_commits(&settings, &repo, 32); assert_eq!(commits_by_level(&repo), vec![64]); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let repo = create_n_commits(&settings, repo, 32); let repo = create_n_commits(&settings, &repo, 16); @@ -451,7 +450,7 @@ fn test_index_commits_incremental_squashed(use_git: bool) { let repo = create_n_commits(&settings, &repo, 2); assert_eq!(commits_by_level(&repo), vec![57, 6]); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let repo = create_n_commits(&settings, repo, 30); let repo = create_n_commits(&settings, &repo, 15); @@ -460,7 +459,7 @@ fn test_index_commits_incremental_squashed(use_git: bool) { let repo = create_n_commits(&settings, &repo, 1); assert_eq!(commits_by_level(&repo), vec![31, 15, 7, 3, 1]); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let repo = create_n_commits(&settings, repo, 10); let repo = create_n_commits(&settings, &repo, 10); diff --git a/lib/tests/test_load_repo.rs b/lib/tests/test_load_repo.rs index 1097ecb41..3a0326d8b 100644 --- a/lib/tests/test_load_repo.rs +++ b/lib/tests/test_load_repo.rs @@ -21,7 +21,7 @@ use test_case::test_case; #[test_case(true ; "git backend")] fn test_load_at_operation(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("add commit"); diff --git a/lib/tests/test_merge_trees.rs b/lib/tests/test_merge_trees.rs index 71df15b85..9907fbc7b 100644 --- a/lib/tests/test_merge_trees.rs +++ b/lib/tests/test_merge_trees.rs @@ -29,8 +29,7 @@ fn test_same_type(use_git: bool) { // Tests all possible cases where the entry type is unchanged, specifically // using only normal files in all trees (no symlinks, no trees, etc.). - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let store = repo.store(); @@ -214,8 +213,7 @@ fn test_same_type(use_git: bool) { fn test_subtrees(use_git: bool) { // Tests that subtrees are merged. - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let store = repo.store(); @@ -271,8 +269,7 @@ fn test_subtrees(use_git: bool) { fn test_subtree_becomes_empty(use_git: bool) { // Tests that subtrees that become empty are removed from the parent tree. - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let store = repo.store(); @@ -303,8 +300,7 @@ fn test_subtree_becomes_empty(use_git: bool) { fn test_subtree_one_missing(use_git: bool) { // Tests that merging trees where one side is missing is resolved as if the // missing side was empty. - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let store = repo.store(); @@ -350,8 +346,7 @@ fn test_types(use_git: bool) { // Tests conflicts between different types. This is mostly to test that the // conflicts survive the roundtrip to the store. - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let store = repo.store(); @@ -460,8 +455,7 @@ fn test_types(use_git: bool) { #[test_case(false ; "local backend")] #[test_case(true ; "git backend")] fn test_simplify_conflict(use_git: bool) { - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let store = repo.store(); @@ -561,7 +555,7 @@ fn test_simplify_conflict(use_git: bool) { #[test_case(true ; "git backend")] fn test_simplify_conflict_after_resolving_parent(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Set up a repo like this: diff --git a/lib/tests/test_mut_repo.rs b/lib/tests/test_mut_repo.rs index b28965670..3ce7a61e8 100644 --- a/lib/tests/test_mut_repo.rs +++ b/lib/tests/test_mut_repo.rs @@ -27,7 +27,7 @@ use test_case::test_case; fn test_checkout_open(use_git: bool) { // Test that MutableRepo::check_out() uses the requested commit if it's open let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -52,7 +52,7 @@ fn test_checkout_closed(use_git: bool) { // Test that MutableRepo::check_out() creates a child if the requested commit is // closed let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -79,7 +79,7 @@ fn test_checkout_previous_not_empty(use_git: bool) { // Test that MutableRepo::check_out() does not usually abandon the previous // commit. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -107,7 +107,7 @@ fn test_checkout_previous_empty(use_git: bool) { // Test that MutableRepo::check_out() abandons the previous commit if it was // empty. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -139,7 +139,7 @@ fn test_checkout_previous_empty_with_description(use_git: bool) { // Test that MutableRepo::check_out() does not abandon the previous commit if it // has a non-empty description. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -172,7 +172,7 @@ fn test_checkout_previous_empty_non_head(use_git: bool) { // Test that MutableRepo::check_out() does not abandon the previous commit if it // was empty and is not a head let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -214,7 +214,7 @@ fn test_checkout_initial(use_git: bool) { // Test that MutableRepo::check_out() can be used on the initial checkout in a // workspace let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -242,7 +242,7 @@ fn test_add_head_success(use_git: bool) { // Test that MutableRepo::add_head() adds the head, and that it's still there // after commit. It should also be indexed. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Create a commit outside of the repo by using a temporary transaction. Then @@ -277,7 +277,7 @@ fn test_add_head_ancestor(use_git: bool) { // Test that MutableRepo::add_head() does not add a head if it's an ancestor of // an existing head. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -307,7 +307,7 @@ fn test_add_head_not_immediate_child(use_git: bool) { // Test that MutableRepo::add_head() can be used for adding a head that is not // an immediate child of a current head. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -356,7 +356,7 @@ fn test_remove_head(use_git: bool) { // for commits no longer visible in that case so we don't have to reindex e.g. // when the user does `jj op undo`. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -393,7 +393,7 @@ fn test_add_public_head(use_git: bool) { // Test that MutableRepo::add_public_head() adds the head, and that it's still // there after commit. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -415,7 +415,7 @@ fn test_add_public_head_ancestor(use_git: bool) { // Test that MutableRepo::add_public_head() does not add a public head if it's // an ancestor of an existing public head. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -440,7 +440,7 @@ fn test_remove_public_head(use_git: bool) { // Test that MutableRepo::remove_public_head() removes the head, and that it's // still removed after commit. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -465,7 +465,7 @@ fn test_has_changed(use_git: bool) { // (e.g. not after setting a branch to point to where it was already // pointing). let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -553,7 +553,7 @@ fn test_rebase_descendants_simple(use_git: bool) { // DescendantRebaser that rebases descendants of rewritten and abandoned // commits. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -591,7 +591,7 @@ fn test_rebase_descendants_conflicting_rewrite(use_git: bool) { // Tests MutableRepo::create_descendant_rebaser() when a commit has been marked // as rewritten to several other commits. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); diff --git a/lib/tests/test_operations.rs b/lib/tests/test_operations.rs index 82f93c89f..7efadbf68 100644 --- a/lib/tests/test_operations.rs +++ b/lib/tests/test_operations.rs @@ -33,7 +33,7 @@ fn list_dir(dir: &Path) -> Vec { fn test_unpublished_operation(use_git: bool) { // Test that the operation doesn't get published until that's requested. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let op_heads_dir = repo.repo_path().join("op_heads"); @@ -56,7 +56,7 @@ fn test_consecutive_operations(use_git: bool) { // Test that consecutive operations result in a single op-head on disk after // each operation let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let op_heads_dir = repo.repo_path().join("op_heads"); @@ -89,7 +89,7 @@ fn test_concurrent_operations(use_git: bool) { // Test that consecutive operations result in multiple op-heads on disk until // the repo has been reloaded (which currently happens right away). let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let op_heads_dir = repo.repo_path().join("op_heads"); @@ -134,7 +134,7 @@ fn assert_heads(repo: RepoRef, expected: Vec<&CommitId>) { fn test_isolation(use_git: bool) { // Test that two concurrent transactions don't see each other's changes. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); diff --git a/lib/tests/test_revset.rs b/lib/tests/test_revset.rs index a53711da3..c5f5c020c 100644 --- a/lib/tests/test_revset.rs +++ b/lib/tests/test_revset.rs @@ -24,8 +24,7 @@ use test_case::test_case; #[test_case(false ; "local backend")] #[test_case(true ; "git backend")] fn test_resolve_symbol_root(use_git: bool) { - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; assert_eq!( @@ -38,7 +37,7 @@ fn test_resolve_symbol_root(use_git: bool) { fn test_resolve_symbol_commit_id() { let settings = testutils::user_settings(); // Test only with git so we can get predictable commit ids - let test_repo = TestRepo::init(&settings, true); + let test_repo = TestRepo::init(true); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -123,9 +122,8 @@ fn test_resolve_symbol_commit_id() { #[test] fn test_resolve_symbol_change_id() { - let settings = testutils::user_settings(); // Test only with git so we can get predictable change ids - let test_repo = TestRepo::init(&settings, true); + let test_repo = TestRepo::init(true); let repo = &test_repo.repo; let git_repo = repo.store().git_repo().unwrap(); @@ -239,7 +237,7 @@ fn test_resolve_symbol_change_id() { #[test_case(true ; "git backend")] fn test_resolve_symbol_checkout(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -288,7 +286,7 @@ fn test_resolve_symbol_checkout(use_git: bool) { #[test] fn test_resolve_symbol_git_refs() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, true); + let test_repo = TestRepo::init(true); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -437,7 +435,7 @@ fn resolve_commit_ids_in_workspace( #[test_case(true ; "git backend")] fn test_evaluate_expression_root_and_checkout(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -464,7 +462,7 @@ fn test_evaluate_expression_root_and_checkout(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_heads(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let root_commit = repo.store().root_commit(); @@ -526,7 +524,7 @@ fn test_evaluate_expression_heads(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_roots(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let root_commit = repo.store().root_commit(); @@ -588,7 +586,7 @@ fn test_evaluate_expression_roots(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_parents(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let root_commit = repo.store().root_commit(); @@ -649,7 +647,7 @@ fn test_evaluate_expression_parents(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_children(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -703,7 +701,7 @@ fn test_evaluate_expression_children(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_ancestors(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let root_commit = repo.store().root_commit(); @@ -739,7 +737,7 @@ fn test_evaluate_expression_ancestors(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_range(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -802,7 +800,7 @@ fn test_evaluate_expression_range(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_dag_range(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let root_commit_id = repo.store().root_commit_id().clone(); @@ -872,7 +870,7 @@ fn test_evaluate_expression_dag_range(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_connected(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let root_commit_id = repo.store().root_commit_id().clone(); @@ -952,7 +950,7 @@ fn test_evaluate_expression_connected(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_descendants(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -1000,8 +998,7 @@ fn test_evaluate_expression_descendants(use_git: bool) { #[test_case(false ; "local backend")] #[test_case(true ; "git backend")] fn test_evaluate_expression_none(use_git: bool) { - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // none() is empty (doesn't include the checkout, for example) @@ -1012,7 +1009,7 @@ fn test_evaluate_expression_none(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_all(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -1040,7 +1037,7 @@ fn test_evaluate_expression_all(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_visible_heads(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -1060,7 +1057,7 @@ fn test_evaluate_expression_visible_heads(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_public_heads(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let root_commit = repo.store().root_commit(); @@ -1093,7 +1090,7 @@ fn test_evaluate_expression_public_heads(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_git_refs(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -1162,7 +1159,7 @@ fn test_evaluate_expression_git_refs(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_git_head(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -1186,7 +1183,7 @@ fn test_evaluate_expression_git_head(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_branches(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -1255,7 +1252,7 @@ fn test_evaluate_expression_branches(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_remote_branches(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -1335,7 +1332,7 @@ fn test_evaluate_expression_remote_branches(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_merges(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -1366,7 +1363,7 @@ fn test_evaluate_expression_merges(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_description(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -1409,7 +1406,7 @@ fn test_evaluate_expression_description(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_author(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -1472,7 +1469,7 @@ fn test_evaluate_expression_author(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_committer(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -1535,7 +1532,7 @@ fn test_evaluate_expression_committer(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_union(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let root_commit = repo.store().root_commit(); @@ -1608,7 +1605,7 @@ fn test_evaluate_expression_union(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_intersection(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let root_commit = repo.store().root_commit(); @@ -1648,7 +1645,7 @@ fn test_evaluate_expression_intersection(use_git: bool) { #[test_case(true ; "git backend")] fn test_evaluate_expression_difference(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let root_commit = repo.store().root_commit(); diff --git a/lib/tests/test_revset_graph_iterator.rs b/lib/tests/test_revset_graph_iterator.rs index 9d870ccf7..304486ef6 100644 --- a/lib/tests/test_revset_graph_iterator.rs +++ b/lib/tests/test_revset_graph_iterator.rs @@ -23,7 +23,7 @@ use test_case::test_case; #[test_case(true ; "skip transitive edges")] fn test_graph_iterator_linearized(skip_transitive_edges: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, true); + let test_repo = TestRepo::init(true); let repo = &test_repo.repo; // Tests that a fork and a merge becomes a single edge: @@ -65,7 +65,7 @@ fn test_graph_iterator_linearized(skip_transitive_edges: bool) { #[test_case(true ; "skip transitive edges")] fn test_graph_iterator_virtual_octopus(skip_transitive_edges: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, true); + let test_repo = TestRepo::init(true); let repo = &test_repo.repo; // Tests that merges outside the set can result in more parent edges than there @@ -127,7 +127,7 @@ fn test_graph_iterator_virtual_octopus(skip_transitive_edges: bool) { #[test_case(true ; "skip transitive edges")] fn test_graph_iterator_simple_fork(skip_transitive_edges: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, true); + let test_repo = TestRepo::init(true); let repo = &test_repo.repo; // Tests that the branch with "C" gets emitted correctly: @@ -175,7 +175,7 @@ fn test_graph_iterator_simple_fork(skip_transitive_edges: bool) { #[test_case(true ; "skip transitive edges")] fn test_graph_iterator_multiple_missing(skip_transitive_edges: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, true); + let test_repo = TestRepo::init(true); let repo = &test_repo.repo; // Tests that we get missing edges to "a" and "c" and not just one missing edge @@ -229,7 +229,7 @@ fn test_graph_iterator_multiple_missing(skip_transitive_edges: bool) { #[test_case(true ; "skip transitive edges")] fn test_graph_iterator_edge_to_ancestor(skip_transitive_edges: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, true); + let test_repo = TestRepo::init(true); let repo = &test_repo.repo; // Tests that we get both an edge from F to D and to D's ancestor C if we keep @@ -294,7 +294,7 @@ fn test_graph_iterator_edge_to_ancestor(skip_transitive_edges: bool) { #[test_case(true ; "skip transitive edges")] fn test_graph_iterator_edge_escapes_from_(skip_transitive_edges: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, true); + let test_repo = TestRepo::init(true); let repo = &test_repo.repo; // Tests a more complex case for skipping transitive edges. @@ -385,7 +385,7 @@ fn test_graph_iterator_edge_escapes_from_(skip_transitive_edges: bool) { #[test] fn test_reverse_graph_iterator() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, true); + let test_repo = TestRepo::init(true); let repo = &test_repo.repo; // Tests that merges, forks, direct edges, indirect edges, and "missing" edges diff --git a/lib/tests/test_rewrite.rs b/lib/tests/test_rewrite.rs index a215cb256..3fefd3d39 100644 --- a/lib/tests/test_rewrite.rs +++ b/lib/tests/test_rewrite.rs @@ -25,7 +25,7 @@ use test_case::test_case; #[test_case(true ; "git backend")] fn test_rebase_descendants_sideways(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Commit B was replaced by commit F. Commits C-E should be rebased. @@ -73,7 +73,7 @@ fn test_rebase_descendants_sideways(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_forward(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Commit B was replaced by commit F. Commits C and E should be rebased onto F. @@ -133,7 +133,7 @@ fn test_rebase_descendants_forward(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_reorder(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Commit E was replaced by commit D, and commit C was replaced by commit F @@ -185,7 +185,7 @@ fn test_rebase_descendants_reorder(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_backward(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Commit C was replaced by commit B. Commit D should be rebased. @@ -223,7 +223,7 @@ fn test_rebase_descendants_backward(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_chain_becomes_branchy(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Commit B was replaced by commit E and commit C was replaced by commit F. @@ -271,7 +271,7 @@ fn test_rebase_descendants_chain_becomes_branchy(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_internal_merge(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Commit B was replaced by commit F. Commits C-E should be rebased. @@ -321,7 +321,7 @@ fn test_rebase_descendants_internal_merge(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_external_merge(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Commit C was replaced by commit F. Commits E should be rebased. The rebased @@ -370,7 +370,7 @@ fn test_rebase_descendants_external_merge(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_abandon(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Commit B and commit E were abandoned. Commit C and commit D should get @@ -416,7 +416,7 @@ fn test_rebase_descendants_abandon(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_abandon_no_descendants(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Commit B and C were abandoned. Commit A should become a head. @@ -451,7 +451,7 @@ fn test_rebase_descendants_abandon_no_descendants(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_abandon_and_replace(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Commit B was replaced by commit E. Commit C was abandoned. Commit D should @@ -490,7 +490,7 @@ fn test_rebase_descendants_abandon_and_replace(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_abandon_degenerate_merge(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Commit B was abandoned. Commit D should get rebased to have only C as parent @@ -528,7 +528,7 @@ fn test_rebase_descendants_abandon_degenerate_merge(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_abandon_widen_merge(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Commit E was abandoned. Commit F should get rebased to have B, C, and D as @@ -574,7 +574,7 @@ fn test_rebase_descendants_abandon_widen_merge(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_multiple_sideways(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Commit B and commit D were both replaced by commit F. Commit C and commit E @@ -621,7 +621,7 @@ fn test_rebase_descendants_multiple_sideways(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_multiple_swap(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Commit B was replaced by commit D. Commit D was replaced by commit B. @@ -666,7 +666,7 @@ fn test_rebase_descendants_multiple_swap(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_multiple_no_descendants(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Commit B was replaced by commit C. Commit C was replaced by commit B. @@ -705,7 +705,7 @@ fn test_rebase_descendants_multiple_no_descendants(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_divergent_rewrite(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Commit B was replaced by commit B2. Commit D was replaced by commits D2 and @@ -773,7 +773,7 @@ fn test_rebase_descendants_divergent_rewrite(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_repeated(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Commit B was replaced by commit B2. Commit C should get rebased. Rebasing @@ -835,7 +835,7 @@ fn test_rebase_descendants_repeated(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_contents(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Commit B was replaced by commit D. Commit C should have the changes from @@ -900,7 +900,7 @@ fn test_rebase_descendants_contents(use_git: bool) { #[test] fn test_rebase_descendants_basic_branch_update() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let repo = &test_repo.repo; // Branch "main" points to commit B. B gets rewritten as B2. Branch main should @@ -935,7 +935,7 @@ fn test_rebase_descendants_basic_branch_update() { #[test] fn test_rebase_descendants_branch_move_two_steps() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let repo = &test_repo.repo; // Branch "main" points to branch C. C gets rewritten as C2 and B gets rewritten @@ -978,7 +978,7 @@ fn test_rebase_descendants_branch_move_two_steps() { #[test] fn test_rebase_descendants_basic_branch_update_with_non_local_branch() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let repo = &test_repo.repo; // Branch "main" points to commit B. B gets rewritten as B2. Branch main should @@ -1033,7 +1033,7 @@ fn test_rebase_descendants_basic_branch_update_with_non_local_branch() { #[test] fn test_rebase_descendants_update_branch_after_abandon() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let repo = &test_repo.repo; // Branch "main" points to commit B. B is then abandoned. Branch main should @@ -1067,7 +1067,7 @@ fn test_rebase_descendants_update_branch_after_abandon() { #[test] fn test_rebase_descendants_update_branches_after_divergent_rewrite() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let repo = &test_repo.repo; // Branch "main" points to commit B. B gets rewritten as B2, B3, B4. Branch main @@ -1123,7 +1123,7 @@ fn test_rebase_descendants_update_branches_after_divergent_rewrite() { #[test] fn test_rebase_descendants_rewrite_updates_branch_conflict() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let repo = &test_repo.repo; // Branch "main" is a conflict removing commit A and adding commits B and C. @@ -1184,7 +1184,7 @@ fn test_rebase_descendants_rewrite_updates_branch_conflict() { #[test] fn test_rebase_descendants_rewrite_resolves_branch_conflict() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let repo = &test_repo.repo; // Branch "main" is a conflict removing ancestor commit A and adding commit B @@ -1227,7 +1227,7 @@ fn test_rebase_descendants_rewrite_resolves_branch_conflict() { #[test] fn test_rebase_descendants_branch_delete_modify_abandon() { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let repo = &test_repo.repo; // Branch "main" initially points to commit A. One operation rewrites it to @@ -1258,7 +1258,7 @@ fn test_rebase_descendants_branch_delete_modify_abandon() { #[test_case(true ; "git backend")] fn test_rebase_descendants_update_checkout_open(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Checked-out, open commit B was replaced by open commit C. C should become @@ -1302,7 +1302,7 @@ fn test_rebase_descendants_update_checkout_open(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_update_checkout_closed(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Checked-out, open commit B was replaced by closed commit C. A child of C @@ -1355,7 +1355,7 @@ fn test_rebase_descendants_update_checkout_closed(use_git: bool) { #[test_case(true ; "git backend")] fn test_rebase_descendants_update_checkout_abandoned_merge(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; // Checked-out, open merge commit D was abandoned. A parent commit should become diff --git a/lib/tests/test_view.rs b/lib/tests/test_view.rs index ca6bafb3b..cc6fdc965 100644 --- a/lib/tests/test_view.rs +++ b/lib/tests/test_view.rs @@ -27,8 +27,7 @@ use test_case::test_case; #[test_case(false ; "local backend")] #[test_case(true ; "git backend")] fn test_heads_empty(use_git: bool) { - let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; assert_eq!( @@ -45,7 +44,7 @@ fn test_heads_empty(use_git: bool) { #[test_case(true ; "git backend")] fn test_heads_fork(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -68,7 +67,7 @@ fn test_heads_fork(use_git: bool) { #[test_case(true ; "git backend")] fn test_heads_merge(use_git: bool) { let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, use_git); + let test_repo = TestRepo::init(use_git); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -86,7 +85,7 @@ fn test_heads_merge(use_git: bool) { fn test_merge_views_heads() { // Tests merging of the view's heads (by performing concurrent operations). let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -153,7 +152,7 @@ fn test_merge_views_heads() { fn test_merge_views_checkout() { // Tests merging of the view's checkout (by performing concurrent operations). let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let repo = &test_repo.repo; // Workspace 1 gets updated in both transactions. @@ -239,7 +238,7 @@ fn test_merge_views_branches() { // Tests merging of branches (by performing concurrent operations). See // test_refs.rs for tests of merging of individual ref targets. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -340,7 +339,7 @@ fn test_merge_views_tags() { // Tests merging of tags (by performing concurrent operations). See // test_refs.rs for tests of merging of individual ref targets. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -386,7 +385,7 @@ fn test_merge_views_git_refs() { // Tests merging of git refs (by performing concurrent operations). See // test_refs.rs for tests of merging of individual ref targets. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let repo = &test_repo.repo; let mut tx = repo.start_transaction("test"); @@ -466,7 +465,7 @@ fn test_merge_views_child_on_rewritten(child_first: bool) { // We start with just commit A. Operation 1 adds commit B on top. Operation 2 // rewrites A as A2. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let mut tx = test_repo.repo.start_transaction("test"); let commit_a = @@ -509,7 +508,7 @@ fn test_merge_views_child_on_rewritten_divergent(on_rewritten: bool, child_first // gets rebased onto A4 if it was based on A2 before, but if it was based on // A3, it should remain there. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let mut tx = test_repo.repo.start_transaction("test"); let commit_a2 = @@ -561,7 +560,7 @@ fn test_merge_views_child_on_abandoned(child_first: bool) { // We start with commit B on top of commit A. Operation 1 adds commit C on top. // Operation 2 abandons B. let settings = testutils::user_settings(); - let test_repo = TestRepo::init(&settings, false); + let test_repo = TestRepo::init(false); let mut tx = test_repo.repo.start_transaction("test"); let commit_a =