From ee2a7dfb20d6be0f6b5112fe1afef7f9fde538b0 Mon Sep 17 00:00:00 2001 From: Waleed Khan Date: Sun, 27 Aug 2023 16:56:48 +0200 Subject: [PATCH] build: delete `git-branchless-testing` crate The `git-branchless-lib` crate has a dev-dependency on `git-branchless-testing`, and `git-branchless-testing` has a dependency on `git-branchless-lib`, inducing a circular dependency that means they can't be published to crates.io. This commit collapses them into the same crate again to resolve this circular dependency. --- Cargo.lock | 31 ++----------------- Cargo.toml | 2 -- git-branchless-hook/Cargo.toml | 1 - git-branchless-hook/tests/test_hook.rs | 2 +- git-branchless-lib/Cargo.toml | 3 +- git-branchless-lib/src/lib.rs | 1 + .../src/testing.rs | 12 +++---- git-branchless-lib/tests/test_eventlog.rs | 2 +- git-branchless-lib/tests/test_git_run.rs | 2 +- git-branchless-lib/tests/test_git_tree.rs | 2 +- git-branchless-lib/tests/test_repo.rs | 2 +- .../tests/test_rewrite_evolve.rs | 2 +- git-branchless-lib/tests/test_rewrite_plan.rs | 2 +- git-branchless-lib/tests/test_snapshot.rs | 2 +- git-branchless-lib/tests/test_status.rs | 2 +- git-branchless-query/Cargo.toml | 1 - git-branchless-query/tests/test_query.rs | 2 +- git-branchless-record/Cargo.toml | 1 - git-branchless-record/tests/test_record.rs | 4 +-- git-branchless-revset/Cargo.toml | 1 - git-branchless-revset/src/eval.rs | 2 +- git-branchless-reword/Cargo.toml | 1 - git-branchless-reword/src/lib.rs | 2 +- git-branchless-smartlog/Cargo.toml | 1 - .../tests/test_smartlog.rs | 2 +- git-branchless-submit/Cargo.toml | 1 - .../tests/test_phabricator_forge.rs | 2 +- git-branchless-submit/tests/test_submit.rs | 4 +-- git-branchless-test/Cargo.toml | 1 - git-branchless-test/src/lib.rs | 2 +- git-branchless-test/tests/test_test.rs | 2 +- git-branchless-testing/Cargo.toml | 21 ------------- git-branchless/Cargo.toml | 1 - git-branchless/tests/test_amend.rs | 2 +- git-branchless/tests/test_branchless.rs | 2 +- git-branchless/tests/test_bug_report.rs | 2 +- git-branchless/tests/test_eventlog.rs | 2 +- git-branchless/tests/test_gc.rs | 2 +- git-branchless/tests/test_git.rs | 2 +- git-branchless/tests/test_hide.rs | 2 +- git-branchless/tests/test_hooks.rs | 2 +- git-branchless/tests/test_init.rs | 6 ++-- git-branchless/tests/test_move.rs | 2 +- git-branchless/tests/test_navigation.rs | 4 +-- git-branchless/tests/test_repair.rs | 2 +- git-branchless/tests/test_restack.rs | 2 +- git-branchless/tests/test_reword.rs | 2 +- git-branchless/tests/test_snapshot.rs | 2 +- git-branchless/tests/test_sync.rs | 2 +- git-branchless/tests/test_undo.rs | 6 ++-- git-branchless/tests/test_wrap.rs | 2 +- 51 files changed, 54 insertions(+), 111 deletions(-) rename git-branchless-testing/src/lib.rs => git-branchless-lib/src/testing.rs (99%) delete mode 100644 git-branchless-testing/Cargo.toml diff --git a/Cargo.lock b/Cargo.lock index 440ab53c2..fc7363204 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1423,7 +1423,6 @@ dependencies = [ "git-branchless-smartlog", "git-branchless-submit", "git-branchless-test", - "git-branchless-testing", "git-branchless-undo", "insta", "itertools 0.11.0", @@ -1452,7 +1451,6 @@ dependencies = [ "git-branchless-invoke", "git-branchless-lib", "git-branchless-opts", - "git-branchless-testing", "insta", "itertools 0.11.0", "lazy_static", @@ -1511,13 +1509,13 @@ dependencies = [ "esl01-dag", "eyre", "futures", - "git-branchless-testing", "git2", "indicatif", "insta", "itertools 0.11.0", "lazy_static", "once_cell", + "portable-pty", "rayon", "regex", "rusqlite", @@ -1531,6 +1529,7 @@ dependencies = [ "tracing-chrome", "tracing-error", "tracing-subscriber", + "vt100", ] [[package]] @@ -1584,7 +1583,6 @@ dependencies = [ "git-branchless-lib", "git-branchless-opts", "git-branchless-revset", - "git-branchless-testing", "insta", "itertools 0.11.0", "tracing", @@ -1601,7 +1599,6 @@ dependencies = [ "git-branchless-invoke", "git-branchless-lib", "git-branchless-opts", - "git-branchless-testing", "insta", "itertools 0.11.0", "rayon", @@ -1622,7 +1619,6 @@ dependencies = [ "futures", "git-branchless-lib", "git-branchless-opts", - "git-branchless-testing", "glob", "insta", "itertools 0.11.0", @@ -1647,7 +1643,6 @@ dependencies = [ "git-branchless-lib", "git-branchless-opts", "git-branchless-revset", - "git-branchless-testing", "insta", "rayon", "shell-words", @@ -1666,7 +1661,6 @@ dependencies = [ "git-branchless-lib", "git-branchless-opts", "git-branchless-revset", - "git-branchless-testing", "insta", "tracing", ] @@ -1684,7 +1678,6 @@ dependencies = [ "git-branchless-opts", "git-branchless-revset", "git-branchless-test", - "git-branchless-testing", "insta", "itertools 0.11.0", "lazy_static", @@ -1712,7 +1705,6 @@ dependencies = [ "git-branchless-lib", "git-branchless-opts", "git-branchless-revset", - "git-branchless-testing", "indexmap 2.0.0", "insta", "itertools 0.11.0", @@ -1728,25 +1720,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "git-branchless-testing" -version = "0.8.0" -dependencies = [ - "anyhow", - "assert_cmd", - "color-eyre", - "eyre", - "git-branchless-lib", - "itertools 0.11.0", - "lazy_static", - "once_cell", - "portable-pty", - "regex", - "tempfile", - "tracing", - "vt100", -] - [[package]] name = "git-branchless-undo" version = "0.8.0" diff --git a/Cargo.toml b/Cargo.toml index e01c5e4c9..f0bc6eb97 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,6 @@ members = [ "git-branchless-smartlog", "git-branchless-submit", "git-branchless-test", - "git-branchless-testing", "git-branchless-undo", "git-branchless", "git-record", @@ -105,6 +104,5 @@ vt100 = "0.15.2" assert_cmd = "2.0.7" cc = "1.0.83" criterion = { version = "0.5.1", features = ["html_reports"] } -git-branchless-testing = { version = "0.8.0", path = "git-branchless-testing" } insta = "1.31.0" maplit = "1.0.2" diff --git a/git-branchless-hook/Cargo.toml b/git-branchless-hook/Cargo.toml index 3c8b9e423..0887d1d7c 100644 --- a/git-branchless-hook/Cargo.toml +++ b/git-branchless-hook/Cargo.toml @@ -20,5 +20,4 @@ regex = { workspace = true } tracing = { workspace = true } [dev-dependencies] -git-branchless-testing = { workspace = true } insta = { workspace = true } diff --git a/git-branchless-hook/tests/test_hook.rs b/git-branchless-hook/tests/test_hook.rs index 4679a67f7..fcca91e9b 100644 --- a/git-branchless-hook/tests/test_hook.rs +++ b/git-branchless-hook/tests/test_hook.rs @@ -1,4 +1,4 @@ -use git_branchless_testing::{make_git, GitRunOptions}; +use lib::testing::{make_git, GitRunOptions}; #[test] fn test_is_rebase_underway() -> eyre::Result<()> { diff --git a/git-branchless-lib/Cargo.toml b/git-branchless-lib/Cargo.toml index 4e87e4066..6c26977fa 100644 --- a/git-branchless-lib/Cargo.toml +++ b/git-branchless-lib/Cargo.toml @@ -60,6 +60,7 @@ indicatif = { workspace = true } itertools = { workspace = true } lazy_static = { workspace = true } once_cell = { workspace = true } +portable-pty = { workspace = true } rayon = { workspace = true } regex = { workspace = true } rusqlite = { workspace = true } @@ -73,9 +74,9 @@ tracing = { workspace = true } tracing-chrome = { workspace = true } tracing-error = { workspace = true } tracing-subscriber = { workspace = true } +vt100 = { workspace = true } [dev-dependencies] cc = { workspace = true } criterion = { workspace = true } -git-branchless-testing = { workspace = true } insta = { workspace = true } diff --git a/git-branchless-lib/src/lib.rs b/git-branchless-lib/src/lib.rs index 35faf4e2e..dfaeffbea 100644 --- a/git-branchless-lib/src/lib.rs +++ b/git-branchless-lib/src/lib.rs @@ -11,4 +11,5 @@ pub mod core; pub mod git; +pub mod testing; pub mod util; diff --git a/git-branchless-testing/src/lib.rs b/git-branchless-lib/src/testing.rs similarity index 99% rename from git-branchless-testing/src/lib.rs rename to git-branchless-lib/src/testing.rs index f88adbafc..d042499e8 100644 --- a/git-branchless-testing/src/lib.rs +++ b/git-branchless-lib/src/testing.rs @@ -11,16 +11,16 @@ use std::ops::Deref; use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; +use crate::core::config::env_vars::{ + get_git_exec_path, get_path_to_git, should_use_separate_command_binary, TEST_GIT, + TEST_SEPARATE_COMMAND_BINARIES, +}; +use crate::git::{GitRunInfo, GitVersion, NonZeroOid, Repo}; +use crate::util::get_sh; use color_eyre::Help; use eyre::Context; use itertools::Itertools; use lazy_static::lazy_static; -use lib::core::config::env_vars::{ - get_git_exec_path, get_path_to_git, should_use_separate_command_binary, TEST_GIT, - TEST_SEPARATE_COMMAND_BINARIES, -}; -use lib::git::{GitRunInfo, GitVersion, NonZeroOid, Repo}; -use lib::util::get_sh; use once_cell::sync::OnceCell; use regex::{Captures, Regex}; use tempfile::TempDir; diff --git a/git-branchless-lib/tests/test_eventlog.rs b/git-branchless-lib/tests/test_eventlog.rs index 13bfecd94..879514cff 100644 --- a/git-branchless-lib/tests/test_eventlog.rs +++ b/git-branchless-lib/tests/test_eventlog.rs @@ -5,7 +5,7 @@ use branchless::core::eventlog::{ testing::new_event_replayer, Event, EventLogDb, EventTransactionId, }; use branchless::git::{MaybeZeroOid, NonZeroOid, ReferenceName}; -use git_branchless_testing::make_git; +use branchless::testing::make_git; #[test] fn test_drop_non_meaningful_events() -> eyre::Result<()> { diff --git a/git-branchless-lib/tests/test_git_run.rs b/git-branchless-lib/tests/test_git_run.rs index 7a765e70a..a4a19ab2e 100644 --- a/git-branchless-lib/tests/test_git_run.rs +++ b/git-branchless-lib/tests/test_git_run.rs @@ -1,5 +1,5 @@ use branchless::git::{GitRunInfo, GitRunOpts}; -use git_branchless_testing::make_git; +use branchless::testing::make_git; #[test] fn test_hook_working_dir() -> eyre::Result<()> { diff --git a/git-branchless-lib/tests/test_git_tree.rs b/git-branchless-lib/tests/test_git_tree.rs index 99905eb7f..3f0341499 100644 --- a/git-branchless-lib/tests/test_git_tree.rs +++ b/git-branchless-lib/tests/test_git_tree.rs @@ -5,7 +5,7 @@ use std::{ }; use branchless::git::{dehydrate_tree, get_changed_paths_between_trees, hydrate_tree, FileMode}; -use git_branchless_testing::make_git; +use branchless::testing::make_git; #[test] fn test_hydrate_tree() -> eyre::Result<()> { diff --git a/git-branchless-lib/tests/test_repo.rs b/git-branchless-lib/tests/test_repo.rs index d9a29fb6a..09317429f 100644 --- a/git-branchless-lib/tests/test_repo.rs +++ b/git-branchless-lib/tests/test_repo.rs @@ -2,7 +2,7 @@ use branchless::git::{ AmendFastOptions, BranchType, CherryPickFastOptions, FileMode, FileStatus, GitVersion, StatusEntry, }; -use git_branchless_testing::make_git; +use branchless::testing::make_git; #[test] fn test_parse_git_version_output() { diff --git a/git-branchless-lib/tests/test_rewrite_evolve.rs b/git-branchless-lib/tests/test_rewrite_evolve.rs index 86280a486..cf2b9ce61 100644 --- a/git-branchless-lib/tests/test_rewrite_evolve.rs +++ b/git-branchless-lib/tests/test_rewrite_evolve.rs @@ -2,8 +2,8 @@ use branchless::core::eventlog::{EventLogDb, EventReplayer}; use branchless::core::formatting::Glyphs; use branchless::core::rewrite::find_rewrite_target; use branchless::git::MaybeZeroOid; +use branchless::testing::{make_git, Git, GitRunOptions}; use branchless::{core::effects::Effects, git::NonZeroOid}; -use git_branchless_testing::{make_git, Git, GitRunOptions}; fn find_rewrite_target_helper( effects: &Effects, diff --git a/git-branchless-lib/tests/test_rewrite_plan.rs b/git-branchless-lib/tests/test_rewrite_plan.rs index 856c6efed..01f20e82e 100644 --- a/git-branchless-lib/tests/test_rewrite_plan.rs +++ b/git-branchless-lib/tests/test_rewrite_plan.rs @@ -15,7 +15,7 @@ use branchless::core::rewrite::{ execute_rebase_plan, BuildRebasePlanOptions, ExecuteRebasePlanOptions, ExecuteRebasePlanResult, RebasePlan, RebasePlanBuilder, RepoResource, }; -use git_branchless_testing::{make_git, Git}; +use branchless::testing::{make_git, Git}; #[test] fn test_cache_shared_between_builders() -> eyre::Result<()> { diff --git a/git-branchless-lib/tests/test_snapshot.rs b/git-branchless-lib/tests/test_snapshot.rs index 868a81e50..02dc51e0f 100644 --- a/git-branchless-lib/tests/test_snapshot.rs +++ b/git-branchless-lib/tests/test_snapshot.rs @@ -4,7 +4,7 @@ use branchless::core::effects::Effects; use branchless::core::eventlog::EventLogDb; use branchless::core::formatting::Glyphs; use branchless::git::WorkingCopyChangesType; -use git_branchless_testing::{make_git, GitRunOptions}; +use branchless::testing::{make_git, GitRunOptions}; #[test] fn test_has_conflicts() -> eyre::Result<()> { diff --git a/git-branchless-lib/tests/test_status.rs b/git-branchless-lib/tests/test_status.rs index 6585c3eea..aa006d826 100644 --- a/git-branchless-lib/tests/test_status.rs +++ b/git-branchless-lib/tests/test_status.rs @@ -3,7 +3,7 @@ use std::path::PathBuf; use branchless::core::effects::Effects; use branchless::core::formatting::Glyphs; use branchless::git::{FileMode, FileStatus, StatusEntry, WorkingCopyChangesType}; -use git_branchless_testing::make_git; +use branchless::testing::make_git; #[test] fn test_parse_status_line() { diff --git a/git-branchless-query/Cargo.toml b/git-branchless-query/Cargo.toml index 24cc5736a..2197fd19e 100644 --- a/git-branchless-query/Cargo.toml +++ b/git-branchless-query/Cargo.toml @@ -19,5 +19,4 @@ lib = { workspace = true } tracing = { workspace = true } [dev-dependencies] -git-branchless-testing = { workspace = true } insta = { workspace = true } diff --git a/git-branchless-query/tests/test_query.rs b/git-branchless-query/tests/test_query.rs index 32204662b..6e9c6654b 100644 --- a/git-branchless-query/tests/test_query.rs +++ b/git-branchless-query/tests/test_query.rs @@ -1,4 +1,4 @@ -use git_branchless_testing::{make_git, GitRunOptions}; +use lib::testing::{make_git, GitRunOptions}; #[test] fn test_query() -> eyre::Result<()> { diff --git a/git-branchless-record/Cargo.toml b/git-branchless-record/Cargo.toml index 5c08a466b..6d614c222 100644 --- a/git-branchless-record/Cargo.toml +++ b/git-branchless-record/Cargo.toml @@ -20,5 +20,4 @@ scm-record = { workspace = true } tracing = { workspace = true } [dev-dependencies] -git-branchless-testing = { workspace = true } insta = { workspace = true } diff --git a/git-branchless-record/tests/test_record.rs b/git-branchless-record/tests/test_record.rs index f87b09ce5..882360073 100644 --- a/git-branchless-record/tests/test_record.rs +++ b/git-branchless-record/tests/test_record.rs @@ -1,5 +1,5 @@ -use git_branchless_testing::pty::{run_in_pty, PtyAction, DOWN_ARROW}; -use git_branchless_testing::{make_git, GitInitOptions, GitRunOptions}; +use lib::testing::pty::{run_in_pty, PtyAction, DOWN_ARROW}; +use lib::testing::{make_git, GitInitOptions, GitRunOptions}; #[test] fn test_record_unstaged_changes() -> eyre::Result<()> { diff --git a/git-branchless-revset/Cargo.toml b/git-branchless-revset/Cargo.toml index c86df90f2..b0b41f402 100644 --- a/git-branchless-revset/Cargo.toml +++ b/git-branchless-revset/Cargo.toml @@ -31,5 +31,4 @@ tracing = { workspace = true } lalrpop = { workspace = true } [dev-dependencies] -git-branchless-testing = { workspace = true } insta = { workspace = true } diff --git a/git-branchless-revset/src/eval.rs b/git-branchless-revset/src/eval.rs index 93d9b2f7b..a81689286 100644 --- a/git-branchless-revset/src/eval.rs +++ b/git-branchless-revset/src/eval.rs @@ -350,12 +350,12 @@ pub(super) fn eval_number_rhs( mod tests { use std::borrow::Cow; - use git_branchless_testing::{make_git, GitRunOptions}; use lib::core::effects::Effects; use lib::core::eventlog::{EventLogDb, EventReplayer}; use lib::core::formatting::Glyphs; use lib::core::repo_ext::RepoExt; use lib::git::Commit; + use lib::testing::{make_git, GitRunOptions}; use super::*; use crate::Expr; diff --git a/git-branchless-reword/Cargo.toml b/git-branchless-reword/Cargo.toml index 7b8139170..3a177fd6e 100644 --- a/git-branchless-reword/Cargo.toml +++ b/git-branchless-reword/Cargo.toml @@ -20,5 +20,4 @@ tempfile = { workspace = true } tracing = { workspace = true } [dev-dependencies] -git-branchless-testing = { workspace = true } insta = { workspace = true } diff --git a/git-branchless-reword/src/lib.rs b/git-branchless-reword/src/lib.rs index a648b7ee2..d7458c9dc 100644 --- a/git-branchless-reword/src/lib.rs +++ b/git-branchless-reword/src/lib.rs @@ -700,7 +700,7 @@ fn render_status_report( #[cfg(test)] mod tests { use super::*; - use git_branchless_testing::make_git; + use lib::testing::make_git; use std::collections::BTreeMap; #[test] diff --git a/git-branchless-smartlog/Cargo.toml b/git-branchless-smartlog/Cargo.toml index 475691122..fdebf8a84 100644 --- a/git-branchless-smartlog/Cargo.toml +++ b/git-branchless-smartlog/Cargo.toml @@ -17,5 +17,4 @@ lib = { workspace = true } tracing = { workspace = true } [dev-dependencies] -git-branchless-testing = { workspace = true } insta = { workspace = true } diff --git a/git-branchless-smartlog/tests/test_smartlog.rs b/git-branchless-smartlog/tests/test_smartlog.rs index e922ed033..09aecf7aa 100644 --- a/git-branchless-smartlog/tests/test_smartlog.rs +++ b/git-branchless-smartlog/tests/test_smartlog.rs @@ -1,4 +1,4 @@ -use git_branchless_testing::{extract_hint_command, make_git, GitRunOptions}; +use lib::testing::{extract_hint_command, make_git, GitRunOptions}; #[test] fn test_init_smartlog() -> eyre::Result<()> { diff --git a/git-branchless-submit/Cargo.toml b/git-branchless-submit/Cargo.toml index 3ac2fd7c7..464523d94 100644 --- a/git-branchless-submit/Cargo.toml +++ b/git-branchless-submit/Cargo.toml @@ -28,5 +28,4 @@ tracing = { workspace = true } [dev-dependencies] clap = { workspace = true } -git-branchless-testing = { workspace = true } insta = { workspace = true } diff --git a/git-branchless-submit/tests/test_phabricator_forge.rs b/git-branchless-submit/tests/test_phabricator_forge.rs index 5f8c7db84..31767ce60 100644 --- a/git-branchless-submit/tests/test_phabricator_forge.rs +++ b/git-branchless-submit/tests/test_phabricator_forge.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use git_branchless_testing::{make_git, GitRunOptions, GitWrapper}; +use lib::testing::{make_git, GitRunOptions, GitWrapper}; fn mock_env(git: &GitWrapper) -> HashMap { git.get_base_env(0) diff --git a/git-branchless-submit/tests/test_submit.rs b/git-branchless-submit/tests/test_submit.rs index 5675c64ba..040264998 100644 --- a/git-branchless-submit/tests/test_submit.rs +++ b/git-branchless-submit/tests/test_submit.rs @@ -1,8 +1,8 @@ -use git_branchless_testing::{ +use lib::git::GitVersion; +use lib::testing::{ make_git_with_remote_repo, remove_nondeterministic_lines, GitInitOptions, GitRunOptions, GitWrapperWithRemoteRepo, }; -use lib::git::GitVersion; /// Minimum version due to changes in the output of `git push`. const MIN_VERSION: GitVersion = GitVersion(2, 36, 0); diff --git a/git-branchless-test/Cargo.toml b/git-branchless-test/Cargo.toml index 1e309c565..1ecec5a79 100644 --- a/git-branchless-test/Cargo.toml +++ b/git-branchless-test/Cargo.toml @@ -32,6 +32,5 @@ tracing = { workspace = true } [dev-dependencies] assert_cmd = { workspace = true } -git-branchless-testing = { workspace = true } insta = { workspace = true } maplit = { workspace = true } diff --git a/git-branchless-test/src/lib.rs b/git-branchless-test/src/lib.rs index d8ff5ec17..5053481e5 100644 --- a/git-branchless-test/src/lib.rs +++ b/git-branchless-test/src/lib.rs @@ -2960,7 +2960,7 @@ pub fn subcommand_clean( #[cfg(test)] mod tests { - use git_branchless_testing::make_git; + use lib::testing::make_git; use super::*; diff --git a/git-branchless-test/tests/test_test.rs b/git-branchless-test/tests/test_test.rs index 130cac252..bc56465ac 100644 --- a/git-branchless-test/tests/test_test.rs +++ b/git-branchless-test/tests/test_test.rs @@ -1,4 +1,4 @@ -use git_branchless_testing::{make_git, GitRunOptions, GitWrapper}; +use lib::testing::{make_git, GitRunOptions, GitWrapper}; use maplit::hashmap; fn write_test_script(git: &GitWrapper) -> eyre::Result<()> { diff --git a/git-branchless-testing/Cargo.toml b/git-branchless-testing/Cargo.toml deleted file mode 100644 index 27aebc462..000000000 --- a/git-branchless-testing/Cargo.toml +++ /dev/null @@ -1,21 +0,0 @@ -[package] -name = "git-branchless-testing" -version = "0.8.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -anyhow = { workspace = true } -assert_cmd = { workspace = true } -color-eyre = { workspace = true } -eyre = { workspace = true } -itertools = { workspace = true } -lazy_static = { workspace = true } -lib = { workspace = true } -once_cell = { workspace = true } -portable-pty = { workspace = true } -regex = { workspace = true } -tempfile = { workspace = true } -tracing = { workspace = true } -vt100 = { workspace = true } diff --git a/git-branchless/Cargo.toml b/git-branchless/Cargo.toml index 11136601e..bf997a09a 100644 --- a/git-branchless/Cargo.toml +++ b/git-branchless/Cargo.toml @@ -57,7 +57,6 @@ tracing-error = { workspace = true } tracing-subscriber = { workspace = true } [dev-dependencies] -git-branchless-testing = { workspace = true } insta = { workspace = true } [package.metadata.release] diff --git a/git-branchless/tests/test_amend.rs b/git-branchless/tests/test_amend.rs index 8c8b6fc6b..ad3fcb3b5 100644 --- a/git-branchless/tests/test_amend.rs +++ b/git-branchless/tests/test_amend.rs @@ -1,4 +1,4 @@ -use git_branchless_testing::{make_git, remove_rebase_lines, trim_lines, GitRunOptions}; +use lib::testing::{make_git, remove_rebase_lines, trim_lines, GitRunOptions}; #[test] fn test_amend_with_children() -> eyre::Result<()> { diff --git a/git-branchless/tests/test_branchless.rs b/git-branchless/tests/test_branchless.rs index 6007e5ab8..e29f1d4cb 100644 --- a/git-branchless/tests/test_branchless.rs +++ b/git-branchless/tests/test_branchless.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; -use git_branchless_testing::{make_git, GitRunOptions}; use itertools::Itertools; +use lib::testing::{make_git, GitRunOptions}; #[test] fn test_commands() -> eyre::Result<()> { diff --git a/git-branchless/tests/test_bug_report.rs b/git-branchless/tests/test_bug_report.rs index 0bb08ae06..de530c25d 100644 --- a/git-branchless/tests/test_bug_report.rs +++ b/git-branchless/tests/test_bug_report.rs @@ -1,5 +1,5 @@ -use git_branchless_testing::make_git; use lazy_static::lazy_static; +use lib::testing::make_git; use regex::Regex; lazy_static! { diff --git a/git-branchless/tests/test_eventlog.rs b/git-branchless/tests/test_eventlog.rs index 6a69d134e..9031b19de 100644 --- a/git-branchless/tests/test_eventlog.rs +++ b/git-branchless/tests/test_eventlog.rs @@ -1,8 +1,8 @@ -use git_branchless_testing::make_git; use lib::core::effects::Effects; use lib::core::eventlog::testing::{get_event_replayer_events, redact_event_timestamp}; use lib::core::eventlog::{Event, EventLogDb, EventReplayer}; use lib::core::formatting::Glyphs; +use lib::testing::make_git; #[test] fn test_git_v2_31_events() -> eyre::Result<()> { diff --git a/git-branchless/tests/test_gc.rs b/git-branchless/tests/test_gc.rs index 7de907cdd..dd4f7d95a 100644 --- a/git-branchless/tests/test_gc.rs +++ b/git-branchless/tests/test_gc.rs @@ -1,8 +1,8 @@ -use git_branchless_testing::{make_git, GitInitOptions}; use itertools::Itertools; use lib::core::eventlog::testing::redact_event_timestamp; use lib::core::eventlog::EventLogDb; use lib::git::GitVersion; +use lib::testing::{make_git, GitInitOptions}; #[test] fn test_gc() -> eyre::Result<()> { diff --git a/git-branchless/tests/test_git.rs b/git-branchless/tests/test_git.rs index 5ded78cd9..0e7603585 100644 --- a/git-branchless/tests/test_git.rs +++ b/git-branchless/tests/test_git.rs @@ -1,5 +1,5 @@ use eyre::WrapErr; -use git_branchless_testing::{make_git, GitRunOptions}; +use lib::testing::{make_git, GitRunOptions}; #[test] fn test_git_is_not_a_wrapper() -> eyre::Result<()> { diff --git a/git-branchless/tests/test_hide.rs b/git-branchless/tests/test_hide.rs index c6d94dd0d..8190ee5e1 100644 --- a/git-branchless/tests/test_hide.rs +++ b/git-branchless/tests/test_hide.rs @@ -1,4 +1,4 @@ -use git_branchless_testing::{ +use lib::testing::{ make_git, make_git_with_remote_repo, GitInitOptions, GitRunOptions, GitWrapperWithRemoteRepo, }; diff --git a/git-branchless/tests/test_hooks.rs b/git-branchless/tests/test_hooks.rs index 406c8412c..cd8d30aff 100644 --- a/git-branchless/tests/test_hooks.rs +++ b/git-branchless/tests/test_hooks.rs @@ -1,10 +1,10 @@ use eyre::{eyre, Context}; -use git_branchless_testing::make_git; use lib::core::effects::Effects; use lib::core::eventlog::testing::{get_event_replayer_events, redact_event_timestamp}; use lib::core::eventlog::{Event, EventLogDb, EventReplayer}; use lib::core::formatting::Glyphs; use lib::git::GitVersion; +use lib::testing::make_git; use lib::util::get_sh; use std::process::Command; diff --git a/git-branchless/tests/test_init.rs b/git-branchless/tests/test_init.rs index 01adc58b2..e51c5eef9 100644 --- a/git-branchless/tests/test_init.rs +++ b/git-branchless/tests/test_init.rs @@ -1,10 +1,10 @@ use std::collections::HashMap; use eyre::Context; -use git_branchless_testing::{ +use lib::git::GitVersion; +use lib::testing::{ make_git, make_git_worktree, GitInitOptions, GitRunOptions, GitWorktreeWrapper, }; -use lib::git::GitVersion; use regex::Regex; #[test] @@ -281,7 +281,7 @@ fn test_init_prompt_for_main_branch() -> eyre::Result<()> { #[cfg(unix)] #[test] fn test_main_branch_not_found_error_message() -> eyre::Result<()> { - use git_branchless_testing::trim_lines; + use lib::testing::trim_lines; let git = make_git()?; diff --git a/git-branchless/tests/test_move.rs b/git-branchless/tests/test_move.rs index 83982b0b1..21ff2cd93 100644 --- a/git-branchless/tests/test_move.rs +++ b/git-branchless/tests/test_move.rs @@ -1,4 +1,4 @@ -use git_branchless_testing::{ +use lib::testing::{ extract_hint_command, make_git, make_git_with_remote_repo, remove_rebase_lines, GitInitOptions, GitRunOptions, GitWrapperWithRemoteRepo, }; diff --git a/git-branchless/tests/test_navigation.rs b/git-branchless/tests/test_navigation.rs index 83514f4f4..aea50f400 100644 --- a/git-branchless/tests/test_navigation.rs +++ b/git-branchless/tests/test_navigation.rs @@ -1,5 +1,5 @@ -use git_branchless_testing::pty::{run_in_pty, PtyAction}; -use git_branchless_testing::{make_git, GitRunOptions}; +use lib::testing::pty::{run_in_pty, PtyAction}; +use lib::testing::{make_git, GitRunOptions}; const CARRIAGE_RETURN: &str = "\r"; const END_OF_TEXT: &str = "\x03"; diff --git a/git-branchless/tests/test_repair.rs b/git-branchless/tests/test_repair.rs index a49f7fab6..5aee57934 100644 --- a/git-branchless/tests/test_repair.rs +++ b/git-branchless/tests/test_repair.rs @@ -1,5 +1,5 @@ -use git_branchless_testing::make_git; use lib::git::{BranchType, ReferenceName}; +use lib::testing::make_git; #[test] fn test_repair_broken_commit() -> eyre::Result<()> { diff --git a/git-branchless/tests/test_restack.rs b/git-branchless/tests/test_restack.rs index 67b073a95..f93b875d0 100644 --- a/git-branchless/tests/test_restack.rs +++ b/git-branchless/tests/test_restack.rs @@ -1,4 +1,4 @@ -use git_branchless_testing::{make_git, remove_rebase_lines, GitInitOptions, GitRunOptions}; +use lib::testing::{make_git, remove_rebase_lines, GitInitOptions, GitRunOptions}; #[test] fn test_restack_amended_commit() -> eyre::Result<()> { diff --git a/git-branchless/tests/test_reword.rs b/git-branchless/tests/test_reword.rs index 5ee498ee0..54bea595d 100644 --- a/git-branchless/tests/test_reword.rs +++ b/git-branchless/tests/test_reword.rs @@ -1,4 +1,4 @@ -use git_branchless_testing::{make_git, GitRunOptions}; +use lib::testing::{make_git, GitRunOptions}; #[test] fn test_reword_head() -> eyre::Result<()> { diff --git a/git-branchless/tests/test_snapshot.rs b/git-branchless/tests/test_snapshot.rs index 8d3c8de6a..6cfbf4a99 100644 --- a/git-branchless/tests/test_snapshot.rs +++ b/git-branchless/tests/test_snapshot.rs @@ -1,7 +1,7 @@ use std::str::FromStr; -use git_branchless_testing::{make_git, trim_lines, GitInitOptions, GitRunOptions}; use lib::git::NonZeroOid; +use lib::testing::{make_git, trim_lines, GitInitOptions, GitRunOptions}; #[test] fn test_restore_snapshot_basic() -> eyre::Result<()> { diff --git a/git-branchless/tests/test_sync.rs b/git-branchless/tests/test_sync.rs index b50bad07e..ae983260c 100644 --- a/git-branchless/tests/test_sync.rs +++ b/git-branchless/tests/test_sync.rs @@ -1,4 +1,4 @@ -use git_branchless_testing::{ +use lib::testing::{ make_git, make_git_with_remote_repo, remove_nondeterministic_lines, GitInitOptions, GitRunOptions, GitWrapperWithRemoteRepo, }; diff --git a/git-branchless/tests/test_undo.rs b/git-branchless/tests/test_undo.rs index 8171fd628..e0d695a46 100644 --- a/git-branchless/tests/test_undo.rs +++ b/git-branchless/tests/test_undo.rs @@ -2,7 +2,6 @@ use std::mem::swap; use std::rc::Rc; use std::sync::{Arc, Mutex}; -use git_branchless_testing::{make_git, trim_lines, Git, GitInitOptions}; use git_branchless_undo::testing::{select_past_event, undo_events}; use git_branchless_undo::tui::testing::{ screen_to_string, CursiveTestingBackend, CursiveTestingEvent, @@ -13,6 +12,7 @@ use lib::core::eventlog::{EventCursor, EventLogDb, EventReplayer}; use lib::core::formatting::Glyphs; use lib::core::repo_ext::RepoExt; use lib::git::{GitRunInfo, GitVersion, Repo}; +use lib::testing::{make_git, trim_lines, Git, GitInitOptions, GitRunOptions}; use cursive_core::event::Key; use cursive_core::{Cursive, CursiveRunner}; @@ -822,7 +822,7 @@ fn test_undo_noninteractive() -> eyre::Result<()> { { let (stdout, _stderr) = git.run_with_options( &["undo"], - &git_branchless_testing::GitRunOptions { + &GitRunOptions { expected_exit_code: 1, input: Some("n".to_string()), ..Default::default() @@ -854,7 +854,7 @@ fn test_undo_noninteractive() -> eyre::Result<()> { { let (stdout, _stderr) = git.run_with_options( &["undo"], - &git_branchless_testing::GitRunOptions { + &GitRunOptions { input: Some("y".to_string()), ..Default::default() }, diff --git a/git-branchless/tests/test_wrap.rs b/git-branchless/tests/test_wrap.rs index aee7cdbbe..b92644034 100644 --- a/git-branchless/tests/test_wrap.rs +++ b/git-branchless/tests/test_wrap.rs @@ -1,9 +1,9 @@ -use git_branchless_testing::{make_git, GitRunOptions}; use lib::core::effects::Effects; use lib::core::eventlog::testing::{get_event_replayer_events, redact_event_timestamp}; use lib::core::eventlog::{Event, EventLogDb, EventReplayer}; use lib::core::formatting::Glyphs; use lib::git::GitVersion; +use lib::testing::{make_git, GitRunOptions}; #[test] fn test_wrap_rebase_in_transaction() -> eyre::Result<()> {