From 8ead72e99f38c9f63acd77e4c50ffe779dccb7d3 Mon Sep 17 00:00:00 2001 From: Matt Kulukundis Date: Thu, 22 Aug 2024 14:18:15 -0400 Subject: [PATCH] formatting only: switch to Item level import ganularity --- cli/examples/custom-backend/main.rs | 28 ++- cli/examples/custom-command/main.rs | 4 +- cli/examples/custom-commit-templater/main.rs | 23 ++- .../custom-operation-templater/main.rs | 9 +- cli/examples/custom-working-copy/main.rs | 29 ++- cli/src/cleanup_guard.rs | 13 +- cli/src/cli_util.rs | 166 ++++++++++++------ cli/src/command_error.rs | 46 +++-- cli/src/commands/abandon.rs | 3 +- cli/src/commands/backout.rs | 3 +- cli/src/commands/bench.rs | 14 +- cli/src/commands/branch/create.rs | 6 +- cli/src/commands/branch/forget.rs | 4 +- cli/src/commands/branch/list.rs | 6 +- cli/src/commands/branch/mod.rs | 37 ++-- cli/src/commands/branch/move.rs | 9 +- cli/src/commands/branch/rename.rs | 3 +- cli/src/commands/branch/set.rs | 9 +- cli/src/commands/branch/track.rs | 6 +- cli/src/commands/branch/untrack.rs | 3 +- cli/src/commands/checkout.rs | 3 +- cli/src/commands/commit.rs | 7 +- cli/src/commands/config/edit.rs | 4 +- cli/src/commands/config/get.rs | 3 +- cli/src/commands/config/list.rs | 5 +- cli/src/commands/config/mod.rs | 15 +- cli/src/commands/config/path.rs | 6 +- cli/src/commands/config/set.rs | 13 +- cli/src/commands/debug/copy_detection.rs | 6 +- cli/src/commands/debug/index.rs | 7 +- cli/src/commands/debug/mod.rs | 39 ++-- cli/src/commands/debug/reindex.rs | 7 +- cli/src/commands/debug/tree.rs | 6 +- cli/src/commands/debug/watchman.rs | 7 +- cli/src/commands/describe.rs | 18 +- cli/src/commands/diff.rs | 7 +- cli/src/commands/diffedit.rs | 3 +- cli/src/commands/duplicate.rs | 7 +- cli/src/commands/edit.rs | 3 +- cli/src/commands/file/chmod.rs | 7 +- cli/src/commands/file/list.rs | 3 +- cli/src/commands/file/show.rs | 19 +- cli/src/commands/fix.rs | 32 ++-- cli/src/commands/git/clone.rs | 28 ++- cli/src/commands/git/fetch.rs | 17 +- cli/src/commands/git/init.rs | 33 ++-- cli/src/commands/git/mod.rs | 34 ++-- cli/src/commands/git/push.rs | 41 +++-- cli/src/commands/git/remote/mod.rs | 15 +- cli/src/commands/git/submodule.rs | 6 +- cli/src/commands/init.rs | 7 +- cli/src/commands/interdiff.rs | 3 +- cli/src/commands/log.rs | 16 +- cli/src/commands/merge.rs | 3 +- cli/src/commands/mod.rs | 10 +- cli/src/commands/move.rs | 9 +- cli/src/commands/new.rs | 16 +- cli/src/commands/next.rs | 4 +- cli/src/commands/obslog.rs | 11 +- cli/src/commands/operation/abandon.rs | 10 +- cli/src/commands/operation/diff.rs | 33 ++-- cli/src/commands/operation/log.rs | 7 +- cli/src/commands/operation/mod.rs | 18 +- cli/src/commands/operation/restore.rs | 4 +- cli/src/commands/operation/show.rs | 6 +- cli/src/commands/operation/undo.rs | 7 +- cli/src/commands/parallelize.rs | 6 +- cli/src/commands/prev.rs | 4 +- cli/src/commands/rebase.rs | 32 ++-- cli/src/commands/resolve.rs | 7 +- cli/src/commands/restore.rs | 6 +- cli/src/commands/root.rs | 3 +- cli/src/commands/run.rs | 6 +- cli/src/commands/show.rs | 3 +- cli/src/commands/sparse.rs | 14 +- cli/src/commands/split.rs | 9 +- cli/src/commands/squash.rs | 14 +- cli/src/commands/status.rs | 6 +- cli/src/commands/tag.rs | 3 +- cli/src/commands/unsquash.rs | 6 +- cli/src/commands/untrack.rs | 3 +- cli/src/commands/util.rs | 12 +- cli/src/commands/workspace/add.rs | 7 +- cli/src/commands/workspace/forget.rs | 3 +- cli/src/commands/workspace/mod.rs | 15 +- cli/src/commands/workspace/root.rs | 3 +- cli/src/commands/workspace/update_stale.rs | 17 +- cli/src/commit_templater.rs | 56 ++++-- cli/src/config.rs | 17 +- cli/src/description_util.rs | 4 +- cli/src/diff_util.rs | 46 +++-- cli/src/formatter.rs | 13 +- cli/src/generic_templater.rs | 17 +- cli/src/git_util.rs | 24 ++- cli/src/graphlog.rs | 4 +- cli/src/merge_tools/builtin.rs | 27 ++- cli/src/merge_tools/diff_working_copies.rs | 15 +- cli/src/merge_tools/external.rs | 36 ++-- cli/src/merge_tools/mod.rs | 18 +- cli/src/movement_util.rs | 13 +- cli/src/operation_templater.rs | 26 ++- cli/src/progress.rs | 10 +- cli/src/revset_util.rs | 27 ++- cli/src/template_builder.rs | 50 ++++-- cli/src/template_parser.rs | 28 ++- cli/src/templater.rs | 13 +- cli/src/text_util.rs | 9 +- cli/src/time_util.rs | 6 +- cli/src/ui.rs | 32 +++- cli/testing/fake-diff-editor.rs | 3 +- cli/testing/fake-editor.rs | 3 +- cli/testing/fake-formatter.rs | 3 +- cli/tests/common/mod.rs | 6 +- cli/tests/test_acls.rs | 4 +- cli/tests/test_commit_command.rs | 3 +- cli/tests/test_describe_command.rs | 6 +- cli/tests/test_diff_command.rs | 4 +- cli/tests/test_diffedit_command.rs | 3 +- cli/tests/test_git_clone.rs | 8 +- cli/tests/test_git_init.rs | 6 +- cli/tests/test_git_private_commits.rs | 3 +- cli/tests/test_git_push.rs | 3 +- cli/tests/test_global_opts.rs | 4 +- cli/tests/test_init_command.rs | 6 +- cli/tests/test_log_command.rs | 3 +- cli/tests/test_move_command.rs | 3 +- cli/tests/test_next_prev_commands.rs | 4 +- cli/tests/test_obslog_command.rs | 3 +- cli/tests/test_operations.rs | 4 +- cli/tests/test_root.rs | 3 +- cli/tests/test_split_command.rs | 3 +- cli/tests/test_squash_command.rs | 3 +- cli/tests/test_unsquash_command.rs | 3 +- lib/benches/diff_bench.rs | 5 +- lib/proc-macros/src/content_hash.rs | 16 +- lib/proc-macros/src/lib.rs | 3 +- lib/src/backend.rs | 8 +- lib/src/commit.rs | 17 +- lib/src/commit_builder.rs | 14 +- lib/src/conflicts.rs | 34 +++- lib/src/content_hash.rs | 3 +- lib/src/copies.rs | 13 +- lib/src/dag_walk.rs | 10 +- lib/src/default_index/composite.rs | 41 +++-- lib/src/default_index/entry.rs | 12 +- lib/src/default_index/mod.rs | 28 ++- lib/src/default_index/mutable.rs | 43 +++-- lib/src/default_index/readonly.rs | 30 +++- lib/src/default_index/rev_walk.rs | 16 +- lib/src/default_index/revset_engine.rs | 45 +++-- .../default_index/revset_graph_iterator.rs | 13 +- lib/src/default_index/store.rs | 31 +++- lib/src/default_submodule_store.rs | 3 +- lib/src/diff.rs | 10 +- lib/src/dsl_util.rs | 3 +- lib/src/extensions_map.rs | 3 +- lib/src/file_util.rs | 13 +- lib/src/files.rs | 13 +- lib/src/fileset.rs | 38 ++-- lib/src/fileset_parser.rs | 8 +- lib/src/fsmonitor.rs | 21 ++- lib/src/git.rs | 21 ++- lib/src/git_backend.rs | 73 ++++++-- lib/src/gitignore.rs | 4 +- lib/src/gpg_signing.rs | 12 +- lib/src/graph.rs | 8 +- lib/src/id_prefix.rs | 14 +- lib/src/index.rs | 10 +- lib/src/local_backend.rs | 40 ++++- lib/src/local_working_copy.rs | 87 ++++++--- lib/src/lock.rs | 3 +- lib/src/lock/fallback.rs | 6 +- lib/src/matchers.rs | 9 +- lib/src/merge.rs | 17 +- lib/src/merged_tree.rs | 45 +++-- lib/src/object_id.rs | 3 +- lib/src/op_heads_store.rs | 4 +- lib/src/op_store.rs | 17 +- lib/src/op_walk.rs | 21 ++- lib/src/operation.rs | 13 +- lib/src/refs.rs | 6 +- lib/src/repo.rs | 90 +++++++--- lib/src/repo_path.rs | 11 +- lib/src/revset.rs | 37 ++-- lib/src/revset_parser.rs | 29 ++- lib/src/rewrite.rs | 28 ++- lib/src/secret_backend.rs | 22 ++- lib/src/settings.rs | 8 +- lib/src/simple_op_heads_store.rs | 9 +- lib/src/simple_op_store.rs | 49 ++++-- lib/src/ssh_signing.rs | 12 +- lib/src/stacked_table.rs | 12 +- lib/src/store.rs | 28 ++- lib/src/str_util.rs | 3 +- lib/src/time_util.rs | 12 +- lib/src/transaction.rs | 9 +- lib/src/tree.rs | 32 ++-- lib/src/tree_builder.rs | 8 +- lib/src/view.rs | 13 +- lib/src/working_copy.rs | 12 +- lib/src/workspace.rs | 49 ++++-- lib/tests/test_bad_locking.rs | 11 +- lib/tests/test_commit_builder.rs | 14 +- lib/tests/test_commit_concurrent.rs | 8 +- lib/tests/test_conflicts.rs | 7 +- .../test_default_revset_graph_iterator.rs | 9 +- lib/tests/test_git.rs | 58 ++++-- lib/tests/test_git_backend.rs | 21 ++- lib/tests/test_gpg.rs | 7 +- lib/tests/test_id_prefix.rs | 16 +- lib/tests/test_index.rs | 37 ++-- lib/tests/test_init.rs | 7 +- lib/tests/test_load_repo.rs | 3 +- lib/tests/test_local_working_copy.rs | 40 +++-- .../test_local_working_copy_concurrent.rs | 15 +- lib/tests/test_local_working_copy_sparse.rs | 10 +- lib/tests/test_merge_trees.rs | 10 +- lib/tests/test_merged_tree.rs | 31 +++- lib/tests/test_mut_repo.rs | 13 +- lib/tests/test_operations.rs | 11 +- lib/tests/test_refs.rs | 3 +- lib/tests/test_revset.rs | 46 +++-- lib/tests/test_rewrite.rs | 30 ++-- lib/tests/test_rewrite_transform.rs | 3 +- lib/tests/test_signing.rs | 14 +- lib/tests/test_ssh_signing.rs | 6 +- lib/tests/test_view.rs | 17 +- lib/tests/test_workspace.rs | 10 +- lib/testutils/src/lib.rs | 39 ++-- lib/testutils/src/test_backend.rs | 38 +++- lib/testutils/src/test_signing_backend.rs | 6 +- rustfmt.toml | 2 +- 232 files changed, 2575 insertions(+), 1097 deletions(-) diff --git a/cli/examples/custom-backend/main.rs b/cli/examples/custom-backend/main.rs index 4d56c546d8..3bdd26160f 100644 --- a/cli/examples/custom-backend/main.rs +++ b/cli/examples/custom-backend/main.rs @@ -19,20 +19,34 @@ use std::time::SystemTime; use async_trait::async_trait; use futures::stream::BoxStream; -use jj_cli::cli_util::{CliRunner, CommandHelper}; +use jj_cli::cli_util::CliRunner; +use jj_cli::cli_util::CommandHelper; use jj_cli::command_error::CommandError; use jj_cli::ui::Ui; -use jj_lib::backend::{ - Backend, BackendInitError, BackendLoadError, BackendResult, ChangeId, Commit, CommitId, - Conflict, ConflictId, CopyRecord, FileId, SigningFn, SymlinkId, Tree, TreeId, -}; +use jj_lib::backend::Backend; +use jj_lib::backend::BackendInitError; +use jj_lib::backend::BackendLoadError; +use jj_lib::backend::BackendResult; +use jj_lib::backend::ChangeId; +use jj_lib::backend::Commit; +use jj_lib::backend::CommitId; +use jj_lib::backend::Conflict; +use jj_lib::backend::ConflictId; +use jj_lib::backend::CopyRecord; +use jj_lib::backend::FileId; +use jj_lib::backend::SigningFn; +use jj_lib::backend::SymlinkId; +use jj_lib::backend::Tree; +use jj_lib::backend::TreeId; use jj_lib::git_backend::GitBackend; use jj_lib::index::Index; use jj_lib::repo::StoreFactories; -use jj_lib::repo_path::{RepoPath, RepoPathBuf}; +use jj_lib::repo_path::RepoPath; +use jj_lib::repo_path::RepoPathBuf; use jj_lib::settings::UserSettings; use jj_lib::signing::Signer; -use jj_lib::workspace::{Workspace, WorkspaceInitError}; +use jj_lib::workspace::Workspace; +use jj_lib::workspace::WorkspaceInitError; #[derive(clap::Parser, Clone, Debug)] enum CustomCommand { diff --git a/cli/examples/custom-command/main.rs b/cli/examples/custom-command/main.rs index bb7e402b0c..209a9717be 100644 --- a/cli/examples/custom-command/main.rs +++ b/cli/examples/custom-command/main.rs @@ -14,7 +14,9 @@ use std::io::Write as _; -use jj_cli::cli_util::{CliRunner, CommandHelper, RevisionArg}; +use jj_cli::cli_util::CliRunner; +use jj_cli::cli_util::CommandHelper; +use jj_cli::cli_util::RevisionArg; use jj_cli::command_error::CommandError; use jj_cli::ui::Ui; diff --git a/cli/examples/custom-commit-templater/main.rs b/cli/examples/custom-commit-templater/main.rs index 0d9efe4729..b32d75729a 100644 --- a/cli/examples/custom-commit-templater/main.rs +++ b/cli/examples/custom-commit-templater/main.rs @@ -17,22 +17,27 @@ use std::rc::Rc; use itertools::Itertools; use jj_cli::cli_util::CliRunner; -use jj_cli::commit_templater::{ - CommitTemplateBuildFnTable, CommitTemplateLanguage, CommitTemplateLanguageExtension, -}; +use jj_cli::commit_templater::CommitTemplateBuildFnTable; +use jj_cli::commit_templater::CommitTemplateLanguage; +use jj_cli::commit_templater::CommitTemplateLanguageExtension; use jj_cli::template_builder::TemplateLanguage; -use jj_cli::template_parser::{self, TemplateParseError}; +use jj_cli::template_parser::TemplateParseError; +use jj_cli::template_parser::{self}; use jj_cli::templater::TemplatePropertyExt as _; use jj_lib::backend::CommitId; use jj_lib::commit::Commit; use jj_lib::extensions_map::ExtensionsMap; use jj_lib::object_id::ObjectId; use jj_lib::repo::Repo; -use jj_lib::revset::{ - FunctionCallNode, PartialSymbolResolver, RevsetExpression, RevsetFilterExtension, - RevsetFilterPredicate, RevsetParseContext, RevsetParseError, RevsetResolutionError, - SymbolResolverExtension, -}; +use jj_lib::revset::FunctionCallNode; +use jj_lib::revset::PartialSymbolResolver; +use jj_lib::revset::RevsetExpression; +use jj_lib::revset::RevsetFilterExtension; +use jj_lib::revset::RevsetFilterPredicate; +use jj_lib::revset::RevsetParseContext; +use jj_lib::revset::RevsetParseError; +use jj_lib::revset::RevsetResolutionError; +use jj_lib::revset::SymbolResolverExtension; use once_cell::sync::OnceCell; struct HexCounter; diff --git a/cli/examples/custom-operation-templater/main.rs b/cli/examples/custom-operation-templater/main.rs index 5db26255d4..3a2e72249c 100644 --- a/cli/examples/custom-operation-templater/main.rs +++ b/cli/examples/custom-operation-templater/main.rs @@ -13,11 +13,12 @@ // limitations under the License. use jj_cli::cli_util::CliRunner; -use jj_cli::operation_templater::{ - OperationTemplateBuildFnTable, OperationTemplateLanguage, OperationTemplateLanguageExtension, -}; +use jj_cli::operation_templater::OperationTemplateBuildFnTable; +use jj_cli::operation_templater::OperationTemplateLanguage; +use jj_cli::operation_templater::OperationTemplateLanguageExtension; use jj_cli::template_builder::TemplateLanguage; -use jj_cli::template_parser::{self, TemplateParseError}; +use jj_cli::template_parser::TemplateParseError; +use jj_cli::template_parser::{self}; use jj_cli::templater::TemplatePropertyExt as _; use jj_lib::extensions_map::ExtensionsMap; use jj_lib::object_id::ObjectId; diff --git a/cli/examples/custom-working-copy/main.rs b/cli/examples/custom-working-copy/main.rs index af94a61757..fbe2e3ab7a 100644 --- a/cli/examples/custom-working-copy/main.rs +++ b/cli/examples/custom-working-copy/main.rs @@ -13,28 +13,39 @@ // limitations under the License. use std::any::Any; -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; use std::sync::Arc; use itertools::Itertools; -use jj_cli::cli_util::{CliRunner, CommandHelper}; +use jj_cli::cli_util::CliRunner; +use jj_cli::cli_util::CommandHelper; use jj_cli::command_error::CommandError; use jj_cli::ui::Ui; -use jj_lib::backend::{Backend, MergedTreeId}; +use jj_lib::backend::Backend; +use jj_lib::backend::MergedTreeId; use jj_lib::commit::Commit; use jj_lib::git_backend::GitBackend; use jj_lib::local_working_copy::LocalWorkingCopy; -use jj_lib::op_store::{OperationId, WorkspaceId}; +use jj_lib::op_store::OperationId; +use jj_lib::op_store::WorkspaceId; use jj_lib::repo::ReadonlyRepo; use jj_lib::repo_path::RepoPathBuf; use jj_lib::settings::UserSettings; use jj_lib::signing::Signer; use jj_lib::store::Store; -use jj_lib::working_copy::{ - CheckoutError, CheckoutStats, LockedWorkingCopy, ResetError, SnapshotError, SnapshotOptions, - WorkingCopy, WorkingCopyFactory, WorkingCopyStateError, -}; -use jj_lib::workspace::{WorkingCopyFactories, Workspace, WorkspaceInitError}; +use jj_lib::working_copy::CheckoutError; +use jj_lib::working_copy::CheckoutStats; +use jj_lib::working_copy::LockedWorkingCopy; +use jj_lib::working_copy::ResetError; +use jj_lib::working_copy::SnapshotError; +use jj_lib::working_copy::SnapshotOptions; +use jj_lib::working_copy::WorkingCopy; +use jj_lib::working_copy::WorkingCopyFactory; +use jj_lib::working_copy::WorkingCopyStateError; +use jj_lib::workspace::WorkingCopyFactories; +use jj_lib::workspace::Workspace; +use jj_lib::workspace::WorkspaceInitError; #[derive(clap::Parser, Clone, Debug)] enum CustomCommand { diff --git a/cli/src/cleanup_guard.rs b/cli/src/cleanup_guard.rs index 500d7b37a4..da96d7e528 100644 --- a/cli/src/cleanup_guard.rs +++ b/cli/src/cleanup_guard.rs @@ -1,5 +1,6 @@ use std::io; -use std::sync::{Mutex, Once}; +use std::sync::Mutex; +use std::sync::Once; use slab::Slab; use tracing::instrument; @@ -46,13 +47,17 @@ impl Drop for CleanupGuard { #[cfg(unix)] mod platform { - use std::os::unix::io::{IntoRawFd as _, RawFd}; + use std::os::unix::io::IntoRawFd as _; + use std::os::unix::io::RawFd; use std::os::unix::net::UnixDatagram; use std::panic::AssertUnwindSafe; - use std::sync::atomic::{AtomicBool, Ordering}; + use std::sync::atomic::AtomicBool; + use std::sync::atomic::Ordering; use std::thread; - use libc::{c_int, SIGINT, SIGTERM}; + use libc::c_int; + use libc::SIGINT; + use libc::SIGTERM; use super::*; diff --git a/cli/src/cli_util.rs b/cli/src/cli_util.rs index bf27ff2f2d..7beca59c3e 100644 --- a/cli/src/cli_util.rs +++ b/cli/src/cli_util.rs @@ -14,94 +14,156 @@ use core::fmt; use std::borrow::Cow; -use std::collections::{BTreeMap, HashSet}; -use std::env::{self, ArgsOs, VarError}; +use std::collections::BTreeMap; +use std::collections::HashSet; +use std::env::ArgsOs; +use std::env::VarError; +use std::env::{self}; use std::ffi::OsString; use std::fmt::Debug; -use std::io::{self, Write as _}; -use std::path::{Path, PathBuf}; +use std::fs; +use std::io::Write as _; +use std::io::{self}; +use std::mem; +use std::path::Path; +use std::path::PathBuf; use std::process::ExitCode; use std::rc::Rc; +use std::str; use std::str::FromStr; use std::sync::Arc; use std::time::SystemTime; -use std::{fs, mem, str}; use bstr::ByteVec as _; use chrono::TimeZone; -use clap::builder::{ - MapValueParser, NonEmptyStringValueParser, TypedValueParser, ValueParserFactory, -}; -use clap::error::{ContextKind, ContextValue}; -use clap::{ArgAction, ArgMatches, Command, FromArgMatches}; -use indexmap::{IndexMap, IndexSet}; +use clap::builder::MapValueParser; +use clap::builder::NonEmptyStringValueParser; +use clap::builder::TypedValueParser; +use clap::builder::ValueParserFactory; +use clap::error::ContextKind; +use clap::error::ContextValue; +use clap::ArgAction; +use clap::ArgMatches; +use clap::Command; +use clap::FromArgMatches; +use indexmap::IndexMap; +use indexmap::IndexSet; use itertools::Itertools; -use jj_lib::backend::{ChangeId, CommitId, MergedTreeId, TreeValue}; +use jj_lib::backend::ChangeId; +use jj_lib::backend::CommitId; +use jj_lib::backend::MergedTreeId; +use jj_lib::backend::TreeValue; use jj_lib::commit::Commit; +use jj_lib::dag_walk; +use jj_lib::file_util; +use jj_lib::fileset; use jj_lib::fileset::FilesetExpression; +use jj_lib::git; use jj_lib::git_backend::GitBackend; -use jj_lib::gitignore::{GitIgnoreError, GitIgnoreFile}; +use jj_lib::gitignore::GitIgnoreError; +use jj_lib::gitignore::GitIgnoreFile; use jj_lib::hex_util::to_reverse_hex; use jj_lib::id_prefix::IdPrefixContext; use jj_lib::matchers::Matcher; use jj_lib::merge::MergedTreeValue; use jj_lib::merged_tree::MergedTree; use jj_lib::object_id::ObjectId; -use jj_lib::op_store::{OpStoreError, OperationId, RefTarget, WorkspaceId}; +use jj_lib::op_heads_store; +use jj_lib::op_store::OpStoreError; +use jj_lib::op_store::OperationId; +use jj_lib::op_store::RefTarget; +use jj_lib::op_store::WorkspaceId; +use jj_lib::op_walk; use jj_lib::op_walk::OpsetEvaluationError; use jj_lib::operation::Operation; -use jj_lib::repo::{ - merge_factories_map, CheckOutCommitError, EditCommitError, MutableRepo, ReadonlyRepo, Repo, - RepoLoader, StoreFactories, StoreLoadError, -}; -use jj_lib::repo_path::{RepoPath, RepoPathBuf, RepoPathUiConverter, UiPathParseError}; -use jj_lib::revset::{ - RevsetAliasesMap, RevsetExpression, RevsetExtensions, RevsetFilterPredicate, RevsetFunction, - RevsetIteratorExt, RevsetModifier, RevsetParseContext, RevsetWorkspaceContext, - SymbolResolverExtension, -}; +use jj_lib::repo::merge_factories_map; +use jj_lib::repo::CheckOutCommitError; +use jj_lib::repo::EditCommitError; +use jj_lib::repo::MutableRepo; +use jj_lib::repo::ReadonlyRepo; +use jj_lib::repo::Repo; +use jj_lib::repo::RepoLoader; +use jj_lib::repo::StoreFactories; +use jj_lib::repo::StoreLoadError; +use jj_lib::repo_path::RepoPath; +use jj_lib::repo_path::RepoPathBuf; +use jj_lib::repo_path::RepoPathUiConverter; +use jj_lib::repo_path::UiPathParseError; +use jj_lib::revset; +use jj_lib::revset::RevsetAliasesMap; +use jj_lib::revset::RevsetExpression; +use jj_lib::revset::RevsetExtensions; +use jj_lib::revset::RevsetFilterPredicate; +use jj_lib::revset::RevsetFunction; +use jj_lib::revset::RevsetIteratorExt; +use jj_lib::revset::RevsetModifier; +use jj_lib::revset::RevsetParseContext; +use jj_lib::revset::RevsetWorkspaceContext; +use jj_lib::revset::SymbolResolverExtension; use jj_lib::rewrite::restore_tree; -use jj_lib::settings::{ConfigResultExt as _, UserSettings}; +use jj_lib::settings::ConfigResultExt as _; +use jj_lib::settings::UserSettings; use jj_lib::signing::SignInitError; use jj_lib::str_util::StringPattern; use jj_lib::transaction::Transaction; use jj_lib::view::View; -use jj_lib::working_copy::{ - CheckoutStats, LockedWorkingCopy, SnapshotOptions, WorkingCopy, WorkingCopyFactory, -}; -use jj_lib::workspace::{ - default_working_copy_factories, LockedWorkspace, WorkingCopyFactories, Workspace, - WorkspaceLoadError, WorkspaceLoader, -}; -use jj_lib::{dag_walk, file_util, fileset, git, op_heads_store, op_walk, revset}; +use jj_lib::working_copy::CheckoutStats; +use jj_lib::working_copy::LockedWorkingCopy; +use jj_lib::working_copy::SnapshotOptions; +use jj_lib::working_copy::WorkingCopy; +use jj_lib::working_copy::WorkingCopyFactory; +use jj_lib::workspace::default_working_copy_factories; +use jj_lib::workspace::LockedWorkspace; +use jj_lib::workspace::WorkingCopyFactories; +use jj_lib::workspace::Workspace; +use jj_lib::workspace::WorkspaceLoadError; +use jj_lib::workspace::WorkspaceLoader; use once_cell::unsync::OnceCell; use tracing::instrument; use tracing_chrome::ChromeLayerBuilder; use tracing_subscriber::prelude::*; -use crate::command_error::{ - cli_error, config_error_with_message, handle_command_result, internal_error, - internal_error_with_message, user_error, user_error_with_hint, user_error_with_message, - CommandError, -}; -use crate::commit_templater::{CommitTemplateLanguage, CommitTemplateLanguageExtension}; -use crate::config::{ - new_config_path, AnnotatedValue, CommandNameAndArgs, ConfigNamePathBuf, ConfigSource, - LayeredConfigs, -}; -use crate::diff_util::{self, DiffFormat, DiffFormatArgs, DiffRenderer}; -use crate::formatter::{FormatRecorder, Formatter, PlainTextFormatter}; -use crate::git_util::{ - is_colocated_git_workspace, print_failed_git_export, print_git_import_stats, -}; -use crate::merge_tools::{DiffEditor, MergeEditor, MergeToolConfigError}; +use crate::command_error::cli_error; +use crate::command_error::config_error_with_message; +use crate::command_error::handle_command_result; +use crate::command_error::internal_error; +use crate::command_error::internal_error_with_message; +use crate::command_error::user_error; +use crate::command_error::user_error_with_hint; +use crate::command_error::user_error_with_message; +use crate::command_error::CommandError; +use crate::commit_templater::CommitTemplateLanguage; +use crate::commit_templater::CommitTemplateLanguageExtension; +use crate::config::new_config_path; +use crate::config::AnnotatedValue; +use crate::config::CommandNameAndArgs; +use crate::config::ConfigNamePathBuf; +use crate::config::ConfigSource; +use crate::config::LayeredConfigs; +use crate::diff_util::DiffFormat; +use crate::diff_util::DiffFormatArgs; +use crate::diff_util::DiffRenderer; +use crate::diff_util::{self}; +use crate::formatter::FormatRecorder; +use crate::formatter::Formatter; +use crate::formatter::PlainTextFormatter; +use crate::git_util::is_colocated_git_workspace; +use crate::git_util::print_failed_git_export; +use crate::git_util::print_git_import_stats; +use crate::merge_tools::DiffEditor; +use crate::merge_tools::MergeEditor; +use crate::merge_tools::MergeToolConfigError; use crate::operation_templater::OperationTemplateLanguageExtension; +use crate::revset_util; use crate::revset_util::RevsetExpressionEvaluator; +use crate::template_builder; use crate::template_builder::TemplateLanguage; use crate::template_parser::TemplateAliasesMap; -use crate::templater::{PropertyPlaceholder, TemplateRenderer}; -use crate::ui::{ColorChoice, Ui}; -use crate::{revset_util, template_builder, text_util}; +use crate::templater::PropertyPlaceholder; +use crate::templater::TemplateRenderer; +use crate::text_util; +use crate::ui::ColorChoice; +use crate::ui::Ui; #[derive(Clone)] struct ChromeTracingFlushGuard { diff --git a/cli/src/command_error.rs b/cli/src/command_error.rs index 8ebff95097..d0e60aa4d4 100644 --- a/cli/src/command_error.rs +++ b/cli/src/command_error.rs @@ -12,37 +12,57 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::error; +use std::io; use std::io::Write as _; +use std::iter; use std::process::ExitCode; +use std::str; use std::sync::Arc; -use std::{error, io, iter, str}; use itertools::Itertools as _; use jj_lib::backend::BackendError; -use jj_lib::fileset::{FilePatternParseError, FilesetParseError, FilesetParseErrorKind}; -use jj_lib::git::{GitConfigParseError, GitExportError, GitImportError, GitRemoteManagementError}; +use jj_lib::fileset::FilePatternParseError; +use jj_lib::fileset::FilesetParseError; +use jj_lib::fileset::FilesetParseErrorKind; +use jj_lib::git::GitConfigParseError; +use jj_lib::git::GitExportError; +use jj_lib::git::GitImportError; +use jj_lib::git::GitRemoteManagementError; use jj_lib::gitignore::GitIgnoreError; use jj_lib::op_heads_store::OpHeadResolutionError; use jj_lib::op_store::OpStoreError; -use jj_lib::op_walk::{OpsetEvaluationError, OpsetResolutionError}; -use jj_lib::repo::{CheckOutCommitError, EditCommitError, RepoLoaderError, RewriteRootCommit}; -use jj_lib::repo_path::{RepoPathBuf, UiPathParseError}; -use jj_lib::revset::{ - RevsetEvaluationError, RevsetParseError, RevsetParseErrorKind, RevsetResolutionError, -}; +use jj_lib::op_walk::OpsetEvaluationError; +use jj_lib::op_walk::OpsetResolutionError; +use jj_lib::repo::CheckOutCommitError; +use jj_lib::repo::EditCommitError; +use jj_lib::repo::RepoLoaderError; +use jj_lib::repo::RewriteRootCommit; +use jj_lib::repo_path::RepoPathBuf; +use jj_lib::repo_path::UiPathParseError; +use jj_lib::revset::RevsetEvaluationError; +use jj_lib::revset::RevsetParseError; +use jj_lib::revset::RevsetParseErrorKind; +use jj_lib::revset::RevsetResolutionError; use jj_lib::signing::SignInitError; use jj_lib::str_util::StringPatternParseError; -use jj_lib::working_copy::{ResetError, SnapshotError, WorkingCopyStateError}; +use jj_lib::working_copy::ResetError; +use jj_lib::working_copy::SnapshotError; +use jj_lib::working_copy::WorkingCopyStateError; use jj_lib::workspace::WorkspaceInitError; use thiserror::Error; use crate::cli_util::short_operation_hash; use crate::description_util::ParseBulkEditMessageError; use crate::diff_util::DiffRenderError; -use crate::formatter::{FormatRecorder, Formatter}; -use crate::merge_tools::{ConflictResolveError, DiffEditError, MergeToolConfigError}; +use crate::formatter::FormatRecorder; +use crate::formatter::Formatter; +use crate::merge_tools::ConflictResolveError; +use crate::merge_tools::DiffEditError; +use crate::merge_tools::MergeToolConfigError; use crate::revset_util::UserRevsetEvaluationError; -use crate::template_parser::{TemplateParseError, TemplateParseErrorKind}; +use crate::template_parser::TemplateParseError; +use crate::template_parser::TemplateParseErrorKind; use crate::ui::Ui; #[derive(Clone, Copy, Debug, Eq, PartialEq)] diff --git a/cli/src/commands/abandon.rs b/cli/src/commands/abandon.rs index 48fcbbcbb8..e3af6cd9f8 100644 --- a/cli/src/commands/abandon.rs +++ b/cli/src/commands/abandon.rs @@ -19,7 +19,8 @@ use jj_lib::commit::CommitIteratorExt; use jj_lib::object_id::ObjectId; use tracing::instrument; -use crate::cli_util::{CommandHelper, RevisionArg}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; use crate::command_error::CommandError; use crate::ui::Ui; diff --git a/cli/src/commands/backout.rs b/cli/src/commands/backout.rs index b56c1c86c6..32c531d250 100644 --- a/cli/src/commands/backout.rs +++ b/cli/src/commands/backout.rs @@ -17,7 +17,8 @@ use jj_lib::object_id::ObjectId; use jj_lib::rewrite::merge_commit_trees; use tracing::instrument; -use crate::cli_util::{CommandHelper, RevisionArg}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; use crate::command_error::CommandError; use crate::ui::Ui; diff --git a/cli/src/commands/bench.rs b/cli/src/commands/bench.rs index 92ccb7c4e0..07b22f4fc5 100644 --- a/cli/src/commands/bench.rs +++ b/cli/src/commands/bench.rs @@ -20,12 +20,20 @@ use std::time::Instant; use clap::Subcommand; use criterion::measurement::Measurement; -use criterion::{BatchSize, BenchmarkGroup, BenchmarkId, Criterion}; +use criterion::BatchSize; +use criterion::BenchmarkGroup; +use criterion::BenchmarkId; +use criterion::Criterion; use jj_lib::object_id::HexPrefix; use jj_lib::repo::Repo; -use jj_lib::revset::{self, DefaultSymbolResolver, RevsetExpression, SymbolResolverExtension}; +use jj_lib::revset::DefaultSymbolResolver; +use jj_lib::revset::RevsetExpression; +use jj_lib::revset::SymbolResolverExtension; +use jj_lib::revset::{self}; -use crate::cli_util::{CommandHelper, RevisionArg, WorkspaceCommandHelper}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::cli_util::WorkspaceCommandHelper; use crate::command_error::CommandError; use crate::ui::Ui; diff --git a/cli/src/commands/branch/create.rs b/cli/src/commands/branch/create.rs index 0f6964d816..16bbbb6af1 100644 --- a/cli/src/commands/branch/create.rs +++ b/cli/src/commands/branch/create.rs @@ -17,8 +17,10 @@ use jj_lib::object_id::ObjectId as _; use jj_lib::op_store::RefTarget; use super::has_tracked_remote_branches; -use crate::cli_util::{CommandHelper, RevisionArg}; -use crate::command_error::{user_error_with_hint, CommandError}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::command_error::user_error_with_hint; +use crate::command_error::CommandError; use crate::ui::Ui; /// Create a new branch diff --git a/cli/src/commands/branch/forget.rs b/cli/src/commands/branch/forget.rs index 0a445380fc..a27b35a32b 100644 --- a/cli/src/commands/branch/forget.rs +++ b/cli/src/commands/branch/forget.rs @@ -13,7 +13,9 @@ // limitations under the License. use itertools::Itertools as _; -use jj_lib::op_store::{BranchTarget, RefTarget, RemoteRef}; +use jj_lib::op_store::BranchTarget; +use jj_lib::op_store::RefTarget; +use jj_lib::op_store::RemoteRef; use jj_lib::str_util::StringPattern; use jj_lib::view::View; diff --git a/cli/src/commands/branch/list.rs b/cli/src/commands/branch/list.rs index 150875cf14..786ffca004 100644 --- a/cli/src/commands/branch/list.rs +++ b/cli/src/commands/branch/list.rs @@ -18,9 +18,11 @@ use jj_lib::git; use jj_lib::revset::RevsetExpression; use jj_lib::str_util::StringPattern; -use crate::cli_util::{CommandHelper, RevisionArg}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; use crate::command_error::CommandError; -use crate::commit_templater::{CommitTemplateLanguage, RefName}; +use crate::commit_templater::CommitTemplateLanguage; +use crate::commit_templater::RefName; use crate::ui::Ui; /// List branches and their targets diff --git a/cli/src/commands/branch/mod.rs b/cli/src/commands/branch/mod.rs index 7d90e035d3..636f787b04 100644 --- a/cli/src/commands/branch/mod.rs +++ b/cli/src/commands/branch/mod.rs @@ -25,22 +25,35 @@ mod untrack; use itertools::Itertools as _; use jj_lib::backend::CommitId; use jj_lib::git; -use jj_lib::op_store::{RefTarget, RemoteRef}; +use jj_lib::op_store::RefTarget; +use jj_lib::op_store::RemoteRef; use jj_lib::repo::Repo; use jj_lib::str_util::StringPattern; use jj_lib::view::View; -use self::create::{cmd_branch_create, BranchCreateArgs}; -use self::delete::{cmd_branch_delete, BranchDeleteArgs}; -use self::forget::{cmd_branch_forget, BranchForgetArgs}; -use self::list::{cmd_branch_list, BranchListArgs}; -use self::r#move::{cmd_branch_move, BranchMoveArgs}; -use self::rename::{cmd_branch_rename, BranchRenameArgs}; -use self::set::{cmd_branch_set, BranchSetArgs}; -use self::track::{cmd_branch_track, BranchTrackArgs}; -use self::untrack::{cmd_branch_untrack, BranchUntrackArgs}; -use crate::cli_util::{CommandHelper, RemoteBranchName, RemoteBranchNamePattern}; -use crate::command_error::{user_error, CommandError}; +use self::create::cmd_branch_create; +use self::create::BranchCreateArgs; +use self::delete::cmd_branch_delete; +use self::delete::BranchDeleteArgs; +use self::forget::cmd_branch_forget; +use self::forget::BranchForgetArgs; +use self::list::cmd_branch_list; +use self::list::BranchListArgs; +use self::r#move::cmd_branch_move; +use self::r#move::BranchMoveArgs; +use self::rename::cmd_branch_rename; +use self::rename::BranchRenameArgs; +use self::set::cmd_branch_set; +use self::set::BranchSetArgs; +use self::track::cmd_branch_track; +use self::track::BranchTrackArgs; +use self::untrack::cmd_branch_untrack; +use self::untrack::BranchUntrackArgs; +use crate::cli_util::CommandHelper; +use crate::cli_util::RemoteBranchName; +use crate::cli_util::RemoteBranchNamePattern; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Manage branches diff --git a/cli/src/commands/branch/move.rs b/cli/src/commands/branch/move.rs index 1179c70bf5..9f5443e5a7 100644 --- a/cli/src/commands/branch/move.rs +++ b/cli/src/commands/branch/move.rs @@ -18,9 +18,12 @@ use jj_lib::object_id::ObjectId as _; use jj_lib::op_store::RefTarget; use jj_lib::str_util::StringPattern; -use super::{find_branches_with, is_fast_forward}; -use crate::cli_util::{CommandHelper, RevisionArg}; -use crate::command_error::{user_error_with_hint, CommandError}; +use super::find_branches_with; +use super::is_fast_forward; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::command_error::user_error_with_hint; +use crate::command_error::CommandError; use crate::ui::Ui; /// Move existing branches to target revision diff --git a/cli/src/commands/branch/rename.rs b/cli/src/commands/branch/rename.rs index 4d2ae459e2..198b51cabb 100644 --- a/cli/src/commands/branch/rename.rs +++ b/cli/src/commands/branch/rename.rs @@ -16,7 +16,8 @@ use jj_lib::op_store::RefTarget; use super::has_tracked_remote_branches; use crate::cli_util::CommandHelper; -use crate::command_error::{user_error, CommandError}; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Rename `old` branch name to `new` branch name diff --git a/cli/src/commands/branch/set.rs b/cli/src/commands/branch/set.rs index c7cc087ba7..2733d77dcf 100644 --- a/cli/src/commands/branch/set.rs +++ b/cli/src/commands/branch/set.rs @@ -16,9 +16,12 @@ use clap::builder::NonEmptyStringValueParser; use jj_lib::object_id::ObjectId as _; use jj_lib::op_store::RefTarget; -use super::{has_tracked_remote_branches, is_fast_forward}; -use crate::cli_util::{CommandHelper, RevisionArg}; -use crate::command_error::{user_error_with_hint, CommandError}; +use super::has_tracked_remote_branches; +use super::is_fast_forward; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::command_error::user_error_with_hint; +use crate::command_error::CommandError; use crate::ui::Ui; /// Create or update a branch to point to a certain commit diff --git a/cli/src/commands/branch/track.rs b/cli/src/commands/branch/track.rs index eae77b105f..a931964293 100644 --- a/cli/src/commands/branch/track.rs +++ b/cli/src/commands/branch/track.rs @@ -17,9 +17,11 @@ use std::collections::HashMap; use itertools::Itertools as _; use super::find_remote_branches; -use crate::cli_util::{CommandHelper, RemoteBranchNamePattern}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RemoteBranchNamePattern; use crate::command_error::CommandError; -use crate::commit_templater::{CommitTemplateLanguage, RefName}; +use crate::commit_templater::CommitTemplateLanguage; +use crate::commit_templater::RefName; use crate::ui::Ui; /// Start tracking given remote branches diff --git a/cli/src/commands/branch/untrack.rs b/cli/src/commands/branch/untrack.rs index 83e7cecc36..d722b2deed 100644 --- a/cli/src/commands/branch/untrack.rs +++ b/cli/src/commands/branch/untrack.rs @@ -16,7 +16,8 @@ use itertools::Itertools as _; use jj_lib::git; use super::find_remote_branches; -use crate::cli_util::{CommandHelper, RemoteBranchNamePattern}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RemoteBranchNamePattern; use crate::command_error::CommandError; use crate::ui::Ui; diff --git a/cli/src/commands/checkout.rs b/cli/src/commands/checkout.rs index 913fce518a..094cf05791 100644 --- a/cli/src/commands/checkout.rs +++ b/cli/src/commands/checkout.rs @@ -15,7 +15,8 @@ use jj_lib::object_id::ObjectId; use tracing::instrument; -use crate::cli_util::{CommandHelper, RevisionArg}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; use crate::command_error::CommandError; use crate::description_util::join_message_paragraphs; use crate::ui::Ui; diff --git a/cli/src/commands/commit.rs b/cli/src/commands/commit.rs index 0c6cb58c12..f810440c11 100644 --- a/cli/src/commands/commit.rs +++ b/cli/src/commands/commit.rs @@ -17,8 +17,11 @@ use jj_lib::repo::Repo; use tracing::instrument; use crate::cli_util::CommandHelper; -use crate::command_error::{user_error, CommandError}; -use crate::description_util::{description_template, edit_description, join_message_paragraphs}; +use crate::command_error::user_error; +use crate::command_error::CommandError; +use crate::description_util::description_template; +use crate::description_util::edit_description; +use crate::description_util::join_message_paragraphs; use crate::ui::Ui; /// Update the description and create a new change on top. diff --git a/cli/src/commands/config/edit.rs b/cli/src/commands/config/edit.rs index 580ce7807f..3e95d0da3f 100644 --- a/cli/src/commands/config/edit.rs +++ b/cli/src/commands/config/edit.rs @@ -15,7 +15,9 @@ use tracing::instrument; use super::ConfigLevelArgs; -use crate::cli_util::{get_new_config_file_path, run_ui_editor, CommandHelper}; +use crate::cli_util::get_new_config_file_path; +use crate::cli_util::run_ui_editor; +use crate::cli_util::CommandHelper; use crate::command_error::CommandError; use crate::ui::Ui; diff --git a/cli/src/commands/config/get.rs b/cli/src/commands/config/get.rs index 16a12ff08e..abeb4eebd2 100644 --- a/cli/src/commands/config/get.rs +++ b/cli/src/commands/config/get.rs @@ -17,7 +17,8 @@ use std::io::Write as _; use tracing::instrument; use crate::cli_util::CommandHelper; -use crate::command_error::{config_error, CommandError}; +use crate::command_error::config_error; +use crate::command_error::CommandError; use crate::config::ConfigNamePathBuf; use crate::ui::Ui; diff --git a/cli/src/commands/config/list.rs b/cli/src/commands/config/list.rs index 4eb16ad1a5..19e900e1b2 100644 --- a/cli/src/commands/config/list.rs +++ b/cli/src/commands/config/list.rs @@ -17,7 +17,10 @@ use tracing::instrument; use super::ConfigLevelArgs; use crate::cli_util::CommandHelper; use crate::command_error::CommandError; -use crate::config::{to_toml_value, AnnotatedValue, ConfigNamePathBuf, ConfigSource}; +use crate::config::to_toml_value; +use crate::config::AnnotatedValue; +use crate::config::ConfigNamePathBuf; +use crate::config::ConfigSource; use crate::generic_templater::GenericTemplateLanguage; use crate::template_builder::TemplateLanguage as _; use crate::templater::TemplatePropertyExt as _; diff --git a/cli/src/commands/config/mod.rs b/cli/src/commands/config/mod.rs index 8069a65db4..6bab134a76 100644 --- a/cli/src/commands/config/mod.rs +++ b/cli/src/commands/config/mod.rs @@ -20,11 +20,16 @@ mod set; use tracing::instrument; -use self::edit::{cmd_config_edit, ConfigEditArgs}; -use self::get::{cmd_config_get, ConfigGetArgs}; -use self::list::{cmd_config_list, ConfigListArgs}; -use self::path::{cmd_config_path, ConfigPathArgs}; -use self::set::{cmd_config_set, ConfigSetArgs}; +use self::edit::cmd_config_edit; +use self::edit::ConfigEditArgs; +use self::get::cmd_config_get; +use self::get::ConfigGetArgs; +use self::list::cmd_config_list; +use self::list::ConfigListArgs; +use self::path::cmd_config_path; +use self::path::ConfigPathArgs; +use self::set::cmd_config_set; +use self::set::ConfigSetArgs; use crate::cli_util::CommandHelper; use crate::command_error::CommandError; use crate::config::ConfigSource; diff --git a/cli/src/commands/config/path.rs b/cli/src/commands/config/path.rs index 629a6e1818..0752f6e8d0 100644 --- a/cli/src/commands/config/path.rs +++ b/cli/src/commands/config/path.rs @@ -17,8 +17,10 @@ use std::io::Write as _; use tracing::instrument; use super::ConfigLevelArgs; -use crate::cli_util::{get_new_config_file_path, CommandHelper}; -use crate::command_error::{user_error, CommandError}; +use crate::cli_util::get_new_config_file_path; +use crate::cli_util::CommandHelper; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Print the path to the config file diff --git a/cli/src/commands/config/set.rs b/cli/src/commands/config/set.rs index 6e4bed58d1..088f1939ac 100644 --- a/cli/src/commands/config/set.rs +++ b/cli/src/commands/config/set.rs @@ -19,11 +19,14 @@ use jj_lib::repo::Repo; use tracing::instrument; use super::ConfigLevelArgs; -use crate::cli_util::{get_new_config_file_path, CommandHelper, WorkspaceCommandHelper}; -use crate::command_error::{user_error, CommandError}; -use crate::config::{ - parse_toml_value_or_bare_string, write_config_value_to_file, ConfigNamePathBuf, -}; +use crate::cli_util::get_new_config_file_path; +use crate::cli_util::CommandHelper; +use crate::cli_util::WorkspaceCommandHelper; +use crate::command_error::user_error; +use crate::command_error::CommandError; +use crate::config::parse_toml_value_or_bare_string; +use crate::config::write_config_value_to_file; +use crate::config::ConfigNamePathBuf; use crate::ui::Ui; /// Update config file to set the given option to a given value. diff --git a/cli/src/commands/debug/copy_detection.rs b/cli/src/commands/debug/copy_detection.rs index 99c89fb5e6..c8ddac1ed9 100644 --- a/cli/src/commands/debug/copy_detection.rs +++ b/cli/src/commands/debug/copy_detection.rs @@ -16,9 +16,11 @@ use std::fmt::Debug; use std::io::Write as _; use futures::executor::block_on_stream; -use jj_lib::backend::{Backend, CopyRecord}; +use jj_lib::backend::Backend; +use jj_lib::backend::CopyRecord; -use crate::cli_util::{CommandHelper, RevisionArg}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; use crate::command_error::CommandError; use crate::ui::Ui; diff --git a/cli/src/commands/debug/index.rs b/cli/src/commands/debug/index.rs index 8793fceede..11406ab039 100644 --- a/cli/src/commands/debug/index.rs +++ b/cli/src/commands/debug/index.rs @@ -15,10 +15,13 @@ use std::fmt::Debug; use std::io::Write as _; -use jj_lib::default_index::{AsCompositeIndex as _, DefaultReadonlyIndex}; +use jj_lib::default_index::AsCompositeIndex as _; +use jj_lib::default_index::DefaultReadonlyIndex; use crate::cli_util::CommandHelper; -use crate::command_error::{internal_error, user_error, CommandError}; +use crate::command_error::internal_error; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Show commit index stats diff --git a/cli/src/commands/debug/mod.rs b/cli/src/commands/debug/mod.rs index 3f09819d36..e01b4e5cae 100644 --- a/cli/src/commands/debug/mod.rs +++ b/cli/src/commands/debug/mod.rs @@ -31,20 +31,33 @@ use std::fmt::Debug; use clap::Subcommand; use jj_lib::local_working_copy::LocalWorkingCopy; -use self::copy_detection::{cmd_debug_copy_detection, CopyDetectionArgs}; -use self::fileset::{cmd_debug_fileset, DebugFilesetArgs}; -use self::index::{cmd_debug_index, DebugIndexArgs}; -use self::local_working_copy::{cmd_debug_local_working_copy, DebugLocalWorkingCopyArgs}; -use self::operation::{cmd_debug_operation, DebugOperationArgs}; -use self::reindex::{cmd_debug_reindex, DebugReindexArgs}; -use self::revset::{cmd_debug_revset, DebugRevsetArgs}; -use self::snapshot::{cmd_debug_snapshot, DebugSnapshotArgs}; -use self::template::{cmd_debug_template, DebugTemplateArgs}; -use self::tree::{cmd_debug_tree, DebugTreeArgs}; -use self::watchman::{cmd_debug_watchman, DebugWatchmanCommand}; -use self::working_copy::{cmd_debug_working_copy, DebugWorkingCopyArgs}; +use self::copy_detection::cmd_debug_copy_detection; +use self::copy_detection::CopyDetectionArgs; +use self::fileset::cmd_debug_fileset; +use self::fileset::DebugFilesetArgs; +use self::index::cmd_debug_index; +use self::index::DebugIndexArgs; +use self::local_working_copy::cmd_debug_local_working_copy; +use self::local_working_copy::DebugLocalWorkingCopyArgs; +use self::operation::cmd_debug_operation; +use self::operation::DebugOperationArgs; +use self::reindex::cmd_debug_reindex; +use self::reindex::DebugReindexArgs; +use self::revset::cmd_debug_revset; +use self::revset::DebugRevsetArgs; +use self::snapshot::cmd_debug_snapshot; +use self::snapshot::DebugSnapshotArgs; +use self::template::cmd_debug_template; +use self::template::DebugTemplateArgs; +use self::tree::cmd_debug_tree; +use self::tree::DebugTreeArgs; +use self::watchman::cmd_debug_watchman; +use self::watchman::DebugWatchmanCommand; +use self::working_copy::cmd_debug_working_copy; +use self::working_copy::DebugWorkingCopyArgs; use crate::cli_util::CommandHelper; -use crate::command_error::{user_error, CommandError}; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Low-level commands not intended for users diff --git a/cli/src/commands/debug/reindex.rs b/cli/src/commands/debug/reindex.rs index b8b2fa7f16..55fd33f2a5 100644 --- a/cli/src/commands/debug/reindex.rs +++ b/cli/src/commands/debug/reindex.rs @@ -15,10 +15,13 @@ use std::fmt::Debug; use std::io::Write as _; -use jj_lib::default_index::{AsCompositeIndex as _, DefaultIndexStore}; +use jj_lib::default_index::AsCompositeIndex as _; +use jj_lib::default_index::DefaultIndexStore; use crate::cli_util::CommandHelper; -use crate::command_error::{internal_error, user_error, CommandError}; +use crate::command_error::internal_error; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Rebuild commit index diff --git a/cli/src/commands/debug/tree.rs b/cli/src/commands/debug/tree.rs index 17ee28aa55..bf5e5fddef 100644 --- a/cli/src/commands/debug/tree.rs +++ b/cli/src/commands/debug/tree.rs @@ -20,8 +20,10 @@ use jj_lib::merged_tree::MergedTree; use jj_lib::repo::Repo; use jj_lib::repo_path::RepoPathBuf; -use crate::cli_util::{CommandHelper, RevisionArg}; -use crate::command_error::{user_error, CommandError}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// List the recursive entries of a tree. diff --git a/cli/src/commands/debug/watchman.rs b/cli/src/commands/debug/watchman.rs index 8c5a67cf1f..1bedc3161a 100644 --- a/cli/src/commands/debug/watchman.rs +++ b/cli/src/commands/debug/watchman.rs @@ -20,12 +20,15 @@ use std::io::Write as _; use clap::Subcommand; #[cfg(feature = "watchman")] -use jj_lib::fsmonitor::{FsmonitorSettings, WatchmanConfig}; +use jj_lib::fsmonitor::FsmonitorSettings; +#[cfg(feature = "watchman")] +use jj_lib::fsmonitor::WatchmanConfig; #[cfg(feature = "watchman")] use jj_lib::local_working_copy::LocalWorkingCopy; use crate::cli_util::CommandHelper; -use crate::command_error::{user_error, CommandError}; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; #[derive(Subcommand, Clone, Debug)] diff --git a/cli/src/commands/describe.rs b/cli/src/commands/describe.rs index 1004cca767..a201253005 100644 --- a/cli/src/commands/describe.rs +++ b/cli/src/commands/describe.rs @@ -13,19 +13,23 @@ // limitations under the License. use std::collections::HashMap; -use std::io::{self, Read}; +use std::io::Read; +use std::io::{self}; use itertools::Itertools; use jj_lib::commit::CommitIteratorExt; use jj_lib::object_id::ObjectId; use tracing::instrument; -use crate::cli_util::{CommandHelper, RevisionArg}; -use crate::command_error::{user_error, CommandError}; -use crate::description_util::{ - description_template, edit_description, edit_multiple_descriptions, join_message_paragraphs, - ParsedBulkEditMessage, -}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::command_error::user_error; +use crate::command_error::CommandError; +use crate::description_util::description_template; +use crate::description_util::edit_description; +use crate::description_util::edit_multiple_descriptions; +use crate::description_util::join_message_paragraphs; +use crate::description_util::ParsedBulkEditMessage; use crate::ui::Ui; /// Update the change description or other metadata diff --git a/cli/src/commands/diff.rs b/cli/src/commands/diff.rs index 4e0b339261..bac1a8cf3d 100644 --- a/cli/src/commands/diff.rs +++ b/cli/src/commands/diff.rs @@ -18,9 +18,12 @@ use jj_lib::repo::Repo; use jj_lib::rewrite::merge_commit_trees; use tracing::instrument; -use crate::cli_util::{print_unmatched_explicit_paths, CommandHelper, RevisionArg}; +use crate::cli_util::print_unmatched_explicit_paths; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; use crate::command_error::CommandError; -use crate::diff_util::{get_copy_records, DiffFormatArgs}; +use crate::diff_util::get_copy_records; +use crate::diff_util::DiffFormatArgs; use crate::ui::Ui; /// Compare file contents between two revisions diff --git a/cli/src/commands/diffedit.rs b/cli/src/commands/diffedit.rs index 3e5efefefd..44f8c90ed4 100644 --- a/cli/src/commands/diffedit.rs +++ b/cli/src/commands/diffedit.rs @@ -20,7 +20,8 @@ use jj_lib::object_id::ObjectId; use jj_lib::rewrite::merge_commit_trees; use tracing::instrument; -use crate::cli_util::{CommandHelper, RevisionArg}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; use crate::command_error::CommandError; use crate::ui::Ui; diff --git a/cli/src/commands/duplicate.rs b/cli/src/commands/duplicate.rs index 0ebe30336c..7191203292 100644 --- a/cli/src/commands/duplicate.rs +++ b/cli/src/commands/duplicate.rs @@ -20,8 +20,11 @@ use jj_lib::commit::Commit; use jj_lib::repo::Repo; use tracing::instrument; -use crate::cli_util::{short_commit_hash, CommandHelper, RevisionArg}; -use crate::command_error::{user_error, CommandError}; +use crate::cli_util::short_commit_hash; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Create a new change with the same content as an existing one diff --git a/cli/src/commands/edit.rs b/cli/src/commands/edit.rs index a209ce610a..609c0bc955 100644 --- a/cli/src/commands/edit.rs +++ b/cli/src/commands/edit.rs @@ -17,7 +17,8 @@ use std::io::Write; use jj_lib::object_id::ObjectId; use tracing::instrument; -use crate::cli_util::{CommandHelper, RevisionArg}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; use crate::command_error::CommandError; use crate::ui::Ui; diff --git a/cli/src/commands/file/chmod.rs b/cli/src/commands/file/chmod.rs index bf4b844692..8b97da4e57 100644 --- a/cli/src/commands/file/chmod.rs +++ b/cli/src/commands/file/chmod.rs @@ -17,8 +17,11 @@ use jj_lib::merged_tree::MergedTreeBuilder; use jj_lib::object_id::ObjectId; use tracing::instrument; -use crate::cli_util::{print_unmatched_explicit_paths, CommandHelper, RevisionArg}; -use crate::command_error::{user_error, CommandError}; +use crate::cli_util::print_unmatched_explicit_paths; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, clap::ValueEnum)] diff --git a/cli/src/commands/file/list.rs b/cli/src/commands/file/list.rs index e0d2b08263..74b7ed6f06 100644 --- a/cli/src/commands/file/list.rs +++ b/cli/src/commands/file/list.rs @@ -16,7 +16,8 @@ use std::io::Write; use tracing::instrument; -use crate::cli_util::{CommandHelper, RevisionArg}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; use crate::command_error::CommandError; use crate::ui::Ui; diff --git a/cli/src/commands/file/show.rs b/cli/src/commands/file/show.rs index f99f26bf1e..973cf824a7 100644 --- a/cli/src/commands/file/show.rs +++ b/cli/src/commands/file/show.rs @@ -12,21 +12,26 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::io::{self, Write}; +use std::io::Write; +use std::io::{self}; use jj_lib::backend::BackendResult; -use jj_lib::conflicts::{materialize_tree_value, MaterializedTreeValue}; -use jj_lib::fileset::{FilePattern, FilesetExpression}; +use jj_lib::conflicts::materialize_tree_value; +use jj_lib::conflicts::MaterializedTreeValue; +use jj_lib::fileset::FilePattern; +use jj_lib::fileset::FilesetExpression; use jj_lib::merge::MergedTreeValue; use jj_lib::repo::Repo; use jj_lib::repo_path::RepoPath; use pollster::FutureExt; use tracing::instrument; -use crate::cli_util::{ - print_unmatched_explicit_paths, CommandHelper, RevisionArg, WorkspaceCommandHelper, -}; -use crate::command_error::{user_error, CommandError}; +use crate::cli_util::print_unmatched_explicit_paths; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::cli_util::WorkspaceCommandHelper; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Print contents of files in a revision diff --git a/cli/src/commands/fix.rs b/cli/src/commands/fix.rs index 9bbd6bc63d..b8a9bc44f9 100644 --- a/cli/src/commands/fix.rs +++ b/cli/src/commands/fix.rs @@ -12,29 +12,41 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::collections::{HashMap, HashSet}; +use std::collections::HashMap; +use std::collections::HashSet; use std::io::Write; use std::process::Stdio; use std::sync::mpsc::channel; use futures::StreamExt; use itertools::Itertools; -use jj_lib::backend::{BackendError, CommitId, FileId, TreeValue}; -use jj_lib::fileset::{self, FilesetExpression}; -use jj_lib::matchers::{EverythingMatcher, Matcher}; -use jj_lib::merged_tree::{MergedTreeBuilder, TreeDiffEntry}; +use jj_lib::backend::BackendError; +use jj_lib::backend::CommitId; +use jj_lib::backend::FileId; +use jj_lib::backend::TreeValue; +use jj_lib::fileset::FilesetExpression; +use jj_lib::fileset::{self}; +use jj_lib::matchers::EverythingMatcher; +use jj_lib::matchers::Matcher; +use jj_lib::merged_tree::MergedTreeBuilder; +use jj_lib::merged_tree::TreeDiffEntry; use jj_lib::repo::Repo; -use jj_lib::repo_path::{RepoPathBuf, RepoPathUiConverter}; -use jj_lib::revset::{RevsetExpression, RevsetIteratorExt}; +use jj_lib::repo_path::RepoPathBuf; +use jj_lib::repo_path::RepoPathUiConverter; +use jj_lib::revset::RevsetExpression; +use jj_lib::revset::RevsetIteratorExt; use jj_lib::store::Store; use pollster::FutureExt; use rayon::iter::IntoParallelIterator; use rayon::prelude::ParallelIterator; use tracing::instrument; -use crate::cli_util::{CommandHelper, RevisionArg}; -use crate::command_error::{config_error, CommandError}; -use crate::config::{to_toml_value, CommandNameAndArgs}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::command_error::config_error; +use crate::command_error::CommandError; +use crate::config::to_toml_value; +use crate::config::CommandNameAndArgs; use crate::ui::Ui; /// Update files with formatting fixes or other changes diff --git a/cli/src/commands/git/clone.rs b/cli/src/commands/git/clone.rs index c35959727a..bbeab27b89 100644 --- a/cli/src/commands/git/clone.rs +++ b/cli/src/commands/git/clone.rs @@ -12,20 +12,32 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::fs; +use std::io; use std::io::Write; -use std::path::{Path, PathBuf}; -use std::{fs, io}; +use std::path::Path; +use std::path::PathBuf; -use jj_lib::git::{self, GitFetchError, GitFetchStats}; +use jj_lib::git::GitFetchError; +use jj_lib::git::GitFetchStats; +use jj_lib::git::{self}; use jj_lib::repo::Repo; use jj_lib::str_util::StringPattern; use jj_lib::workspace::Workspace; -use crate::cli_util::{CommandHelper, WorkspaceCommandHelper}; -use crate::command_error::{cli_error, user_error, user_error_with_message, CommandError}; -use crate::commands::git::{map_git_error, maybe_add_gitignore}; -use crate::config::{write_config_value_to_file, ConfigNamePathBuf}; -use crate::git_util::{get_git_repo, print_git_import_stats, with_remote_git_callbacks}; +use crate::cli_util::CommandHelper; +use crate::cli_util::WorkspaceCommandHelper; +use crate::command_error::cli_error; +use crate::command_error::user_error; +use crate::command_error::user_error_with_message; +use crate::command_error::CommandError; +use crate::commands::git::map_git_error; +use crate::commands::git::maybe_add_gitignore; +use crate::config::write_config_value_to_file; +use crate::config::ConfigNamePathBuf; +use crate::git_util::get_git_repo; +use crate::git_util::print_git_import_stats; +use crate::git_util::with_remote_git_callbacks; use crate::ui::Ui; /// Create a new repo backed by a clone of a Git repo diff --git a/cli/src/commands/git/fetch.rs b/cli/src/commands/git/fetch.rs index 88efbce307..9184c0ba5c 100644 --- a/cli/src/commands/git/fetch.rs +++ b/cli/src/commands/git/fetch.rs @@ -13,15 +13,22 @@ // limitations under the License. use itertools::Itertools; -use jj_lib::git::{self, GitFetchError}; +use jj_lib::git::GitFetchError; +use jj_lib::git::{self}; use jj_lib::repo::Repo; -use jj_lib::settings::{ConfigResultExt as _, UserSettings}; +use jj_lib::settings::ConfigResultExt as _; +use jj_lib::settings::UserSettings; use jj_lib::str_util::StringPattern; use crate::cli_util::CommandHelper; -use crate::command_error::{user_error, user_error_with_hint, CommandError}; -use crate::commands::git::{get_single_remote, map_git_error}; -use crate::git_util::{get_git_repo, print_git_import_stats, with_remote_git_callbacks}; +use crate::command_error::user_error; +use crate::command_error::user_error_with_hint; +use crate::command_error::CommandError; +use crate::commands::git::get_single_remote; +use crate::commands::git::map_git_error; +use crate::git_util::get_git_repo; +use crate::git_util::print_git_import_stats; +use crate::git_util::with_remote_git_callbacks; use crate::ui::Ui; /// Fetch from a Git remote diff --git a/cli/src/commands/git/init.rs b/cli/src/commands/git/init.rs index fe6575d57d..824802c1ab 100644 --- a/cli/src/commands/git/init.rs +++ b/cli/src/commands/git/init.rs @@ -13,23 +13,32 @@ // limitations under the License. use std::io::Write; -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; use std::sync::Arc; -use jj_lib::git::{parse_git_ref, RefName}; -use jj_lib::repo::{ReadonlyRepo, Repo}; +use jj_lib::file_util; +use jj_lib::git; +use jj_lib::git::parse_git_ref; +use jj_lib::git::RefName; +use jj_lib::repo::ReadonlyRepo; +use jj_lib::repo::Repo; use jj_lib::workspace::Workspace; -use jj_lib::{file_util, git}; -use crate::cli_util::{print_trackable_remote_branches, start_repo_transaction, CommandHelper}; -use crate::command_error::{ - cli_error, user_error_with_hint, user_error_with_message, CommandError, -}; +use crate::cli_util::print_trackable_remote_branches; +use crate::cli_util::start_repo_transaction; +use crate::cli_util::CommandHelper; +use crate::command_error::cli_error; +use crate::command_error::user_error_with_hint; +use crate::command_error::user_error_with_message; +use crate::command_error::CommandError; use crate::commands::git::maybe_add_gitignore; -use crate::config::{write_config_value_to_file, ConfigNamePathBuf}; -use crate::git_util::{ - get_git_repo, is_colocated_git_workspace, print_failed_git_export, print_git_import_stats, -}; +use crate::config::write_config_value_to_file; +use crate::config::ConfigNamePathBuf; +use crate::git_util::get_git_repo; +use crate::git_util::is_colocated_git_workspace; +use crate::git_util::print_failed_git_export; +use crate::git_util::print_git_import_stats; use crate::ui::Ui; /// Create a new Git backed repo. diff --git a/cli/src/commands/git/mod.rs b/cli/src/commands/git/mod.rs index 4b4fdd09f4..6fa82a9b43 100644 --- a/cli/src/commands/git/mod.rs +++ b/cli/src/commands/git/mod.rs @@ -23,18 +23,28 @@ pub mod submodule; use clap::Subcommand; -use self::clone::{cmd_git_clone, GitCloneArgs}; -use self::export::{cmd_git_export, GitExportArgs}; -use self::fetch::{cmd_git_fetch, GitFetchArgs}; -use self::import::{cmd_git_import, GitImportArgs}; -use self::init::{cmd_git_init, GitInitArgs}; -use self::push::{cmd_git_push, GitPushArgs}; -use self::remote::{cmd_git_remote, RemoteCommand}; -use self::submodule::{cmd_git_submodule, GitSubmoduleCommand}; -use crate::cli_util::{CommandHelper, WorkspaceCommandHelper}; -use crate::command_error::{ - user_error, user_error_with_hint, user_error_with_message, CommandError, -}; +use self::clone::cmd_git_clone; +use self::clone::GitCloneArgs; +use self::export::cmd_git_export; +use self::export::GitExportArgs; +use self::fetch::cmd_git_fetch; +use self::fetch::GitFetchArgs; +use self::import::cmd_git_import; +use self::import::GitImportArgs; +use self::init::cmd_git_init; +use self::init::GitInitArgs; +use self::push::cmd_git_push; +use self::push::GitPushArgs; +use self::remote::cmd_git_remote; +use self::remote::RemoteCommand; +use self::submodule::cmd_git_submodule; +use self::submodule::GitSubmoduleCommand; +use crate::cli_util::CommandHelper; +use crate::cli_util::WorkspaceCommandHelper; +use crate::command_error::user_error; +use crate::command_error::user_error_with_hint; +use crate::command_error::user_error_with_message; +use crate::command_error::CommandError; use crate::ui::Ui; /// Commands for working with Git remotes and the underlying Git repo diff --git a/cli/src/commands/git/push.rs b/cli/src/commands/git/push.rs index e0fbedb177..7f025a4099 100644 --- a/cli/src/commands/git/push.rs +++ b/cli/src/commands/git/push.rs @@ -12,32 +12,45 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::collections::{HashMap, HashSet}; +use std::collections::HashMap; +use std::collections::HashSet; +use std::fmt; +use std::io; use std::io::Write; -use std::{fmt, io}; use clap::ArgGroup; use itertools::Itertools; use jj_lib::backend::CommitId; -use jj_lib::git::{self, GitBranchPushTargets, GitPushError}; +use jj_lib::git::GitBranchPushTargets; +use jj_lib::git::GitPushError; +use jj_lib::git::{self}; use jj_lib::object_id::ObjectId; use jj_lib::op_store::RefTarget; -use jj_lib::refs::{ - classify_branch_push_action, BranchPushAction, BranchPushUpdate, LocalAndRemoteRef, -}; +use jj_lib::refs::classify_branch_push_action; +use jj_lib::refs::BranchPushAction; +use jj_lib::refs::BranchPushUpdate; +use jj_lib::refs::LocalAndRemoteRef; use jj_lib::repo::Repo; use jj_lib::revset::RevsetExpression; -use jj_lib::settings::{ConfigResultExt as _, UserSettings}; +use jj_lib::settings::ConfigResultExt as _; +use jj_lib::settings::UserSettings; use jj_lib::str_util::StringPattern; use jj_lib::view::View; -use crate::cli_util::{ - short_change_hash, short_commit_hash, CommandHelper, RevisionArg, WorkspaceCommandHelper, - WorkspaceCommandTransaction, -}; -use crate::command_error::{user_error, user_error_with_hint, CommandError}; -use crate::commands::git::{get_single_remote, map_git_error}; -use crate::git_util::{get_git_repo, with_remote_git_callbacks, GitSidebandProgressMessageWriter}; +use crate::cli_util::short_change_hash; +use crate::cli_util::short_commit_hash; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::cli_util::WorkspaceCommandHelper; +use crate::cli_util::WorkspaceCommandTransaction; +use crate::command_error::user_error; +use crate::command_error::user_error_with_hint; +use crate::command_error::CommandError; +use crate::commands::git::get_single_remote; +use crate::commands::git::map_git_error; +use crate::git_util::get_git_repo; +use crate::git_util::with_remote_git_callbacks; +use crate::git_util::GitSidebandProgressMessageWriter; use crate::revset_util; use crate::ui::Ui; diff --git a/cli/src/commands/git/remote/mod.rs b/cli/src/commands/git/remote/mod.rs index 659fd82f6e..3d56ec4b36 100644 --- a/cli/src/commands/git/remote/mod.rs +++ b/cli/src/commands/git/remote/mod.rs @@ -20,11 +20,16 @@ pub mod set_url; use clap::Subcommand; -use self::add::{cmd_git_remote_add, GitRemoteAddArgs}; -use self::list::{cmd_git_remote_list, GitRemoteListArgs}; -use self::remove::{cmd_git_remote_remove, GitRemoteRemoveArgs}; -use self::rename::{cmd_git_remote_rename, GitRemoteRenameArgs}; -use self::set_url::{cmd_git_remote_set_url, GitRemoteSetUrlArgs}; +use self::add::cmd_git_remote_add; +use self::add::GitRemoteAddArgs; +use self::list::cmd_git_remote_list; +use self::list::GitRemoteListArgs; +use self::remove::cmd_git_remote_remove; +use self::remove::GitRemoteRemoveArgs; +use self::rename::cmd_git_remote_rename; +use self::rename::GitRemoteRenameArgs; +use self::set_url::cmd_git_remote_set_url; +use self::set_url::GitRemoteSetUrlArgs; use crate::cli_util::CommandHelper; use crate::command_error::CommandError; use crate::ui::Ui; diff --git a/cli/src/commands/git/submodule.rs b/cli/src/commands/git/submodule.rs index e7185143c5..c0a42940f3 100644 --- a/cli/src/commands/git/submodule.rs +++ b/cli/src/commands/git/submodule.rs @@ -20,8 +20,10 @@ use jj_lib::git::parse_gitmodules; use jj_lib::repo::Repo; use jj_lib::repo_path::RepoPath; -use crate::cli_util::{CommandHelper, RevisionArg}; -use crate::command_error::{user_error, CommandError}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// FOR INTERNAL USE ONLY Interact with git submodules diff --git a/cli/src/commands/init.rs b/cli/src/commands/init.rs index d499f5c2cd..ad2b39efb9 100644 --- a/cli/src/commands/init.rs +++ b/cli/src/commands/init.rs @@ -21,9 +21,10 @@ use tracing::instrument; use super::git; use crate::cli_util::CommandHelper; -use crate::command_error::{ - cli_error, user_error_with_hint, user_error_with_message, CommandError, -}; +use crate::command_error::cli_error; +use crate::command_error::user_error_with_hint; +use crate::command_error::user_error_with_message; +use crate::command_error::CommandError; use crate::ui::Ui; /// Create a new repo in the given directory diff --git a/cli/src/commands/interdiff.rs b/cli/src/commands/interdiff.rs index 717e645ff8..ded5fd99e9 100644 --- a/cli/src/commands/interdiff.rs +++ b/cli/src/commands/interdiff.rs @@ -18,7 +18,8 @@ use clap::ArgGroup; use jj_lib::rewrite::rebase_to_dest_parent; use tracing::instrument; -use crate::cli_util::{CommandHelper, RevisionArg}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; use crate::command_error::CommandError; use crate::diff_util::DiffFormatArgs; use crate::ui::Ui; diff --git a/cli/src/commands/log.rs b/cli/src/commands/log.rs index 7a92b4bafb..874f192a46 100644 --- a/cli/src/commands/log.rs +++ b/cli/src/commands/log.rs @@ -13,16 +13,24 @@ // limitations under the License. use jj_lib::backend::CommitId; -use jj_lib::graph::{GraphEdgeType, ReverseGraphIterator, TopoGroupedGraphIterator}; +use jj_lib::graph::GraphEdgeType; +use jj_lib::graph::ReverseGraphIterator; +use jj_lib::graph::TopoGroupedGraphIterator; use jj_lib::repo::Repo; -use jj_lib::revset::{RevsetExpression, RevsetFilterPredicate, RevsetIteratorExt}; +use jj_lib::revset::RevsetExpression; +use jj_lib::revset::RevsetFilterPredicate; +use jj_lib::revset::RevsetIteratorExt; use tracing::instrument; -use crate::cli_util::{format_template, CommandHelper, LogContentFormat, RevisionArg}; +use crate::cli_util::format_template; +use crate::cli_util::CommandHelper; +use crate::cli_util::LogContentFormat; +use crate::cli_util::RevisionArg; use crate::command_error::CommandError; use crate::commit_templater::CommitTemplateLanguage; use crate::diff_util::DiffFormatArgs; -use crate::graphlog::{get_graphlog, Edge}; +use crate::graphlog::get_graphlog; +use crate::graphlog::Edge; use crate::ui::Ui; /// Show revision history diff --git a/cli/src/commands/merge.rs b/cli/src/commands/merge.rs index f7f500aa46..84cbdb02f9 100644 --- a/cli/src/commands/merge.rs +++ b/cli/src/commands/merge.rs @@ -16,7 +16,8 @@ use tracing::instrument; use super::new; use crate::cli_util::CommandHelper; -use crate::command_error::{cli_error, CommandError}; +use crate::command_error::cli_error; +use crate::command_error::CommandError; use crate::ui::Ui; #[instrument(skip_all)] diff --git a/cli/src/commands/mod.rs b/cli/src/commands/mod.rs index 4498ed398c..4ca8e02d54 100644 --- a/cli/src/commands/mod.rs +++ b/cli/src/commands/mod.rs @@ -59,11 +59,15 @@ mod workspace; use std::fmt::Debug; -use clap::{CommandFactory, FromArgMatches, Subcommand}; +use clap::CommandFactory; +use clap::FromArgMatches; +use clap::Subcommand; use tracing::instrument; -use crate::cli_util::{Args, CommandHelper}; -use crate::command_error::{user_error_with_hint, CommandError}; +use crate::cli_util::Args; +use crate::cli_util::CommandHelper; +use crate::command_error::user_error_with_hint; +use crate::command_error::CommandError; use crate::ui::Ui; #[derive(clap::Parser, Clone, Debug)] diff --git a/cli/src/commands/move.rs b/cli/src/commands/move.rs index 230c722a45..989ea1cc63 100644 --- a/cli/src/commands/move.rs +++ b/cli/src/commands/move.rs @@ -16,9 +16,12 @@ use clap::ArgGroup; use jj_lib::object_id::ObjectId; use tracing::instrument; -use super::squash::{move_diff, SquashedDescription}; -use crate::cli_util::{CommandHelper, RevisionArg}; -use crate::command_error::{user_error, CommandError}; +use super::squash::move_diff; +use super::squash::SquashedDescription; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Move changes from one revision into another (DEPRECATED, use `jj squash`) diff --git a/cli/src/commands/new.rs b/cli/src/commands/new.rs index ddd7a9c160..3408ebf386 100644 --- a/cli/src/commands/new.rs +++ b/cli/src/commands/new.rs @@ -19,13 +19,19 @@ use std::rc::Rc; use itertools::Itertools; use jj_lib::backend::CommitId; use jj_lib::commit::CommitIteratorExt; -use jj_lib::repo::{ReadonlyRepo, Repo}; -use jj_lib::revset::{RevsetExpression, RevsetIteratorExt}; -use jj_lib::rewrite::{merge_commit_trees, rebase_commit}; +use jj_lib::repo::ReadonlyRepo; +use jj_lib::repo::Repo; +use jj_lib::revset::RevsetExpression; +use jj_lib::revset::RevsetIteratorExt; +use jj_lib::rewrite::merge_commit_trees; +use jj_lib::rewrite::rebase_commit; use tracing::instrument; -use crate::cli_util::{short_commit_hash, CommandHelper, RevisionArg}; -use crate::command_error::{user_error, CommandError}; +use crate::cli_util::short_commit_hash; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::description_util::join_message_paragraphs; use crate::ui::Ui; diff --git a/cli/src/commands/next.rs b/cli/src/commands/next.rs index 992884e65d..a3f78262ec 100644 --- a/cli/src/commands/next.rs +++ b/cli/src/commands/next.rs @@ -14,7 +14,9 @@ use crate::cli_util::CommandHelper; use crate::command_error::CommandError; -use crate::movement_util::{move_to_commit, Direction, MovementArgs}; +use crate::movement_util::move_to_commit; +use crate::movement_util::Direction; +use crate::movement_util::MovementArgs; use crate::ui::Ui; /// Move the working-copy commit to the child revision diff --git a/cli/src/commands/obslog.rs b/cli/src/commands/obslog.rs index b645f0c7b8..11465165e2 100644 --- a/cli/src/commands/obslog.rs +++ b/cli/src/commands/obslog.rs @@ -20,12 +20,17 @@ use jj_lib::repo::Repo; use jj_lib::rewrite::rebase_to_dest_parent; use tracing::instrument; -use crate::cli_util::{format_template, CommandHelper, LogContentFormat, RevisionArg}; +use crate::cli_util::format_template; +use crate::cli_util::CommandHelper; +use crate::cli_util::LogContentFormat; +use crate::cli_util::RevisionArg; use crate::command_error::CommandError; use crate::commit_templater::CommitTemplateLanguage; -use crate::diff_util::{DiffFormatArgs, DiffRenderer}; +use crate::diff_util::DiffFormatArgs; +use crate::diff_util::DiffRenderer; use crate::formatter::Formatter; -use crate::graphlog::{get_graphlog, Edge}; +use crate::graphlog::get_graphlog; +use crate::graphlog::Edge; use crate::ui::Ui; /// Show how a change has evolved over time diff --git a/cli/src/commands/operation/abandon.rs b/cli/src/commands/operation/abandon.rs index 082c3e2abf..ec647a81a8 100644 --- a/cli/src/commands/operation/abandon.rs +++ b/cli/src/commands/operation/abandon.rs @@ -13,14 +13,18 @@ // limitations under the License. use std::io::Write as _; -use std::{iter, slice}; +use std::iter; +use std::slice; use itertools::Itertools as _; use jj_lib::op_walk; use jj_lib::operation::Operation; -use crate::cli_util::{short_operation_hash, CommandHelper}; -use crate::command_error::{cli_error, user_error, CommandError}; +use crate::cli_util::short_operation_hash; +use crate::cli_util::CommandHelper; +use crate::command_error::cli_error; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Abandon operation history diff --git a/cli/src/commands/operation/diff.rs b/cli/src/commands/operation/diff.rs index 17d8a714f8..8ddf556ab0 100644 --- a/cli/src/commands/operation/diff.rs +++ b/cli/src/commands/operation/diff.rs @@ -17,23 +17,36 @@ use std::sync::Arc; use indexmap::IndexMap; use itertools::Itertools; -use jj_lib::backend::{ChangeId, CommitId}; +use jj_lib::backend::ChangeId; +use jj_lib::backend::CommitId; use jj_lib::commit::Commit; +use jj_lib::dag_walk; use jj_lib::git::REMOTE_NAME_FOR_LOCAL_GIT_REPO; -use jj_lib::graph::{GraphEdge, TopoGroupedGraphIterator}; +use jj_lib::graph::GraphEdge; +use jj_lib::graph::TopoGroupedGraphIterator; use jj_lib::matchers::EverythingMatcher; -use jj_lib::op_store::{RefTarget, RemoteRef, RemoteRefState}; -use jj_lib::refs::{diff_named_ref_targets, diff_named_remote_refs}; -use jj_lib::repo::{ReadonlyRepo, Repo}; +use jj_lib::op_store::RefTarget; +use jj_lib::op_store::RemoteRef; +use jj_lib::op_store::RemoteRefState; +use jj_lib::refs::diff_named_ref_targets; +use jj_lib::refs::diff_named_remote_refs; +use jj_lib::repo::ReadonlyRepo; +use jj_lib::repo::Repo; +use jj_lib::revset; use jj_lib::revset::RevsetIteratorExt as _; use jj_lib::rewrite::rebase_to_dest_parent; -use jj_lib::{dag_walk, revset}; -use crate::cli_util::{short_change_hash, short_operation_hash, CommandHelper, LogContentFormat}; -use crate::command_error::{user_error, CommandError}; -use crate::diff_util::{DiffFormatArgs, DiffRenderer}; +use crate::cli_util::short_change_hash; +use crate::cli_util::short_operation_hash; +use crate::cli_util::CommandHelper; +use crate::cli_util::LogContentFormat; +use crate::command_error::user_error; +use crate::command_error::CommandError; +use crate::diff_util::DiffFormatArgs; +use crate::diff_util::DiffRenderer; use crate::formatter::Formatter; -use crate::graphlog::{get_graphlog, Edge}; +use crate::graphlog::get_graphlog; +use crate::graphlog::Edge; use crate::templater::TemplateRenderer; use crate::ui::Ui; diff --git a/cli/src/commands/operation/log.rs b/cli/src/commands/operation/log.rs index 0ccfb5e34c..dd77882227 100644 --- a/cli/src/commands/operation/log.rs +++ b/cli/src/commands/operation/log.rs @@ -16,9 +16,12 @@ use std::slice; use jj_lib::op_walk; -use crate::cli_util::{format_template, CommandHelper, LogContentFormat}; +use crate::cli_util::format_template; +use crate::cli_util::CommandHelper; +use crate::cli_util::LogContentFormat; use crate::command_error::CommandError; -use crate::graphlog::{get_graphlog, Edge}; +use crate::graphlog::get_graphlog; +use crate::graphlog::Edge; use crate::operation_templater::OperationTemplateLanguage; use crate::ui::Ui; diff --git a/cli/src/commands/operation/mod.rs b/cli/src/commands/operation/mod.rs index aef1925c7f..5c72fea51b 100644 --- a/cli/src/commands/operation/mod.rs +++ b/cli/src/commands/operation/mod.rs @@ -19,13 +19,19 @@ mod restore; mod show; pub mod undo; -use abandon::{cmd_op_abandon, OperationAbandonArgs}; +use abandon::cmd_op_abandon; +use abandon::OperationAbandonArgs; use clap::Subcommand; -use diff::{cmd_op_diff, OperationDiffArgs}; -use log::{cmd_op_log, OperationLogArgs}; -use restore::{cmd_op_restore, OperationRestoreArgs}; -use show::{cmd_op_show, OperationShowArgs}; -use undo::{cmd_op_undo, OperationUndoArgs}; +use diff::cmd_op_diff; +use diff::OperationDiffArgs; +use log::cmd_op_log; +use log::OperationLogArgs; +use restore::cmd_op_restore; +use restore::OperationRestoreArgs; +use show::cmd_op_show; +use show::OperationShowArgs; +use undo::cmd_op_undo; +use undo::OperationUndoArgs; use crate::cli_util::CommandHelper; use crate::command_error::CommandError; diff --git a/cli/src/commands/operation/restore.rs b/cli/src/commands/operation/restore.rs index a9c9dc2695..f086aad486 100644 --- a/cli/src/commands/operation/restore.rs +++ b/cli/src/commands/operation/restore.rs @@ -14,7 +14,9 @@ use jj_lib::object_id::ObjectId; -use super::{view_with_desired_portions_restored, UndoWhatToRestore, DEFAULT_UNDO_WHAT}; +use super::view_with_desired_portions_restored; +use super::UndoWhatToRestore; +use super::DEFAULT_UNDO_WHAT; use crate::cli_util::CommandHelper; use crate::command_error::CommandError; use crate::ui::Ui; diff --git a/cli/src/commands/operation/show.rs b/cli/src/commands/operation/show.rs index 987567bbfb..6c2be28a64 100644 --- a/cli/src/commands/operation/show.rs +++ b/cli/src/commands/operation/show.rs @@ -15,8 +15,10 @@ use itertools::Itertools; use super::diff::show_op_diff; -use crate::cli_util::{CommandHelper, LogContentFormat}; -use crate::command_error::{user_error, CommandError}; +use crate::cli_util::CommandHelper; +use crate::cli_util::LogContentFormat; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::diff_util::DiffFormatArgs; use crate::operation_templater::OperationTemplateLanguage; use crate::ui::Ui; diff --git a/cli/src/commands/operation/undo.rs b/cli/src/commands/operation/undo.rs index 2468ce62f2..1376c6d9fd 100644 --- a/cli/src/commands/operation/undo.rs +++ b/cli/src/commands/operation/undo.rs @@ -15,9 +15,12 @@ use jj_lib::object_id::ObjectId; use jj_lib::repo::Repo; -use super::{view_with_desired_portions_restored, UndoWhatToRestore, DEFAULT_UNDO_WHAT}; +use super::view_with_desired_portions_restored; +use super::UndoWhatToRestore; +use super::DEFAULT_UNDO_WHAT; use crate::cli_util::CommandHelper; -use crate::command_error::{user_error, CommandError}; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Create a new operation that undoes an earlier operation diff --git a/cli/src/commands/parallelize.rs b/cli/src/commands/parallelize.rs index 083a36e030..33e5327957 100644 --- a/cli/src/commands/parallelize.rs +++ b/cli/src/commands/parallelize.rs @@ -17,10 +17,12 @@ use std::collections::HashMap; use indexmap::IndexSet; use itertools::Itertools; use jj_lib::backend::CommitId; -use jj_lib::commit::{Commit, CommitIteratorExt}; +use jj_lib::commit::Commit; +use jj_lib::commit::CommitIteratorExt; use tracing::instrument; -use crate::cli_util::{CommandHelper, RevisionArg}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; use crate::command_error::CommandError; use crate::ui::Ui; diff --git a/cli/src/commands/prev.rs b/cli/src/commands/prev.rs index 0396115f5f..3808025f2b 100644 --- a/cli/src/commands/prev.rs +++ b/cli/src/commands/prev.rs @@ -14,7 +14,9 @@ use crate::cli_util::CommandHelper; use crate::command_error::CommandError; -use crate::movement_util::{move_to_commit, Direction, MovementArgs}; +use crate::movement_util::move_to_commit; +use crate::movement_util::Direction; +use crate::movement_util::MovementArgs; use crate::ui::Ui; /// Change the working copy revision relative to the parent revision /// diff --git a/cli/src/commands/rebase.rs b/cli/src/commands/rebase.rs index 277daebd75..8b7699d344 100644 --- a/cli/src/commands/rebase.rs +++ b/cli/src/commands/rebase.rs @@ -21,22 +21,30 @@ use clap::ArgGroup; use indexmap::IndexSet; use itertools::Itertools; use jj_lib::backend::CommitId; -use jj_lib::commit::{Commit, CommitIteratorExt}; +use jj_lib::commit::Commit; +use jj_lib::commit::CommitIteratorExt; use jj_lib::object_id::ObjectId; -use jj_lib::repo::{ReadonlyRepo, Repo}; -use jj_lib::revset::{RevsetExpression, RevsetIteratorExt}; -use jj_lib::rewrite::{ - move_commits, rebase_commit_with_options, CommitRewriter, EmptyBehaviour, MoveCommitsStats, - RebaseOptions, -}; +use jj_lib::repo::ReadonlyRepo; +use jj_lib::repo::Repo; +use jj_lib::revset::RevsetExpression; +use jj_lib::revset::RevsetIteratorExt; +use jj_lib::rewrite::move_commits; +use jj_lib::rewrite::rebase_commit_with_options; +use jj_lib::rewrite::CommitRewriter; +use jj_lib::rewrite::EmptyBehaviour; +use jj_lib::rewrite::MoveCommitsStats; +use jj_lib::rewrite::RebaseOptions; use jj_lib::settings::UserSettings; use tracing::instrument; -use crate::cli_util::{ - short_commit_hash, CommandHelper, RevisionArg, WorkspaceCommandHelper, - WorkspaceCommandTransaction, -}; -use crate::command_error::{cli_error, user_error, CommandError}; +use crate::cli_util::short_commit_hash; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::cli_util::WorkspaceCommandHelper; +use crate::cli_util::WorkspaceCommandTransaction; +use crate::command_error::cli_error; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Move revisions to different parent(s) diff --git a/cli/src/commands/resolve.rs b/cli/src/commands/resolve.rs index 22b5c90a22..b57bc22e33 100644 --- a/cli/src/commands/resolve.rs +++ b/cli/src/commands/resolve.rs @@ -18,8 +18,11 @@ use itertools::Itertools; use jj_lib::object_id::ObjectId; use tracing::instrument; -use crate::cli_util::{print_conflicted_paths, CommandHelper, RevisionArg}; -use crate::command_error::{cli_error, CommandError}; +use crate::cli_util::print_conflicted_paths; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::command_error::cli_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Resolve a conflicted file with an external merge tool diff --git a/cli/src/commands/restore.rs b/cli/src/commands/restore.rs index 2c9e7ba106..af6d111a5d 100644 --- a/cli/src/commands/restore.rs +++ b/cli/src/commands/restore.rs @@ -18,8 +18,10 @@ use jj_lib::object_id::ObjectId; use jj_lib::rewrite::restore_tree; use tracing::instrument; -use crate::cli_util::{CommandHelper, RevisionArg}; -use crate::command_error::{user_error, CommandError}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Restore paths from another revision diff --git a/cli/src/commands/root.rs b/cli/src/commands/root.rs index 21efe0f40f..a76d6ea1d5 100644 --- a/cli/src/commands/root.rs +++ b/cli/src/commands/root.rs @@ -17,7 +17,8 @@ use std::io::Write as _; use tracing::instrument; use crate::cli_util::CommandHelper; -use crate::command_error::{user_error, CommandError}; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Show the current workspace root directory diff --git a/cli/src/commands/run.rs b/cli/src/commands/run.rs index b8ad983bb2..2a15607bb4 100644 --- a/cli/src/commands/run.rs +++ b/cli/src/commands/run.rs @@ -16,8 +16,10 @@ use itertools::Itertools as _; -use crate::cli_util::{CommandHelper, RevisionArg}; -use crate::command_error::{user_error, CommandError}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// (**Stub**, does not work yet) Run a command across a set of revisions. diff --git a/cli/src/commands/show.rs b/cli/src/commands/show.rs index 89f5af87a1..9dfb0f0733 100644 --- a/cli/src/commands/show.rs +++ b/cli/src/commands/show.rs @@ -15,7 +15,8 @@ use jj_lib::matchers::EverythingMatcher; use tracing::instrument; -use crate::cli_util::{CommandHelper, RevisionArg}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; use crate::command_error::CommandError; use crate::diff_util::DiffFormatArgs; use crate::ui::Ui; diff --git a/cli/src/commands/sparse.rs b/cli/src/commands/sparse.rs index 4e04f439de..02d61f317c 100644 --- a/cli/src/commands/sparse.rs +++ b/cli/src/commands/sparse.rs @@ -23,12 +23,14 @@ use jj_lib::repo_path::RepoPathBuf; use jj_lib::settings::UserSettings; use tracing::instrument; -use crate::cli_util::{ - edit_temp_file, print_checkout_stats, CommandHelper, WorkspaceCommandHelper, -}; -use crate::command_error::{ - internal_error, internal_error_with_message, user_error_with_message, CommandError, -}; +use crate::cli_util::edit_temp_file; +use crate::cli_util::print_checkout_stats; +use crate::cli_util::CommandHelper; +use crate::cli_util::WorkspaceCommandHelper; +use crate::command_error::internal_error; +use crate::command_error::internal_error_with_message; +use crate::command_error::user_error_with_message; +use crate::command_error::CommandError; use crate::ui::Ui; /// Manage which paths from the working-copy commit are present in the working diff --git a/cli/src/commands/split.rs b/cli/src/commands/split.rs index 458d12a81d..68114443e6 100644 --- a/cli/src/commands/split.rs +++ b/cli/src/commands/split.rs @@ -17,9 +17,12 @@ use jj_lib::object_id::ObjectId; use jj_lib::repo::Repo; use tracing::instrument; -use crate::cli_util::{CommandHelper, RevisionArg}; -use crate::command_error::{user_error_with_hint, CommandError}; -use crate::description_util::{description_template, edit_description}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::command_error::user_error_with_hint; +use crate::command_error::CommandError; +use crate::description_util::description_template; +use crate::description_util::edit_description; use crate::ui::Ui; /// Split a revision in two diff --git a/cli/src/commands/squash.rs b/cli/src/commands/squash.rs index 84fa140e44..74ae40d38d 100644 --- a/cli/src/commands/squash.rs +++ b/cli/src/commands/squash.rs @@ -13,7 +13,8 @@ // limitations under the License. use itertools::Itertools as _; -use jj_lib::commit::{Commit, CommitIteratorExt}; +use jj_lib::commit::Commit; +use jj_lib::commit::CommitIteratorExt; use jj_lib::matchers::Matcher; use jj_lib::merged_tree::MergedTree; use jj_lib::object_id::ObjectId; @@ -21,9 +22,14 @@ use jj_lib::repo::Repo; use jj_lib::settings::UserSettings; use tracing::instrument; -use crate::cli_util::{CommandHelper, DiffSelector, RevisionArg, WorkspaceCommandTransaction}; -use crate::command_error::{user_error, CommandError}; -use crate::description_util::{combine_messages, join_message_paragraphs}; +use crate::cli_util::CommandHelper; +use crate::cli_util::DiffSelector; +use crate::cli_util::RevisionArg; +use crate::cli_util::WorkspaceCommandTransaction; +use crate::command_error::user_error; +use crate::command_error::CommandError; +use crate::description_util::combine_messages; +use crate::description_util::join_message_paragraphs; use crate::ui::Ui; /// Move changes from a revision into another revision diff --git a/cli/src/commands/status.rs b/cli/src/commands/status.rs index bb025a3a2b..81c1eab687 100644 --- a/cli/src/commands/status.rs +++ b/cli/src/commands/status.rs @@ -14,10 +14,12 @@ use itertools::Itertools; use jj_lib::repo::Repo; -use jj_lib::revset::{RevsetExpression, RevsetFilterPredicate}; +use jj_lib::revset::RevsetExpression; +use jj_lib::revset::RevsetFilterPredicate; use tracing::instrument; -use crate::cli_util::{print_conflicted_paths, CommandHelper}; +use crate::cli_util::print_conflicted_paths; +use crate::cli_util::CommandHelper; use crate::command_error::CommandError; use crate::diff_util::DiffFormat; use crate::revset_util; diff --git a/cli/src/commands/tag.rs b/cli/src/commands/tag.rs index 848d2fb1af..fe0bae7a27 100644 --- a/cli/src/commands/tag.rs +++ b/cli/src/commands/tag.rs @@ -16,7 +16,8 @@ use jj_lib::str_util::StringPattern; use crate::cli_util::CommandHelper; use crate::command_error::CommandError; -use crate::commit_templater::{CommitTemplateLanguage, RefName}; +use crate::commit_templater::CommitTemplateLanguage; +use crate::commit_templater::RefName; use crate::ui::Ui; /// Manage tags. diff --git a/cli/src/commands/unsquash.rs b/cli/src/commands/unsquash.rs index 1b6c1ea0fc..411443947a 100644 --- a/cli/src/commands/unsquash.rs +++ b/cli/src/commands/unsquash.rs @@ -16,8 +16,10 @@ use jj_lib::matchers::EverythingMatcher; use jj_lib::object_id::ObjectId; use tracing::instrument; -use crate::cli_util::{CommandHelper, RevisionArg}; -use crate::command_error::{user_error, CommandError}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::description_util::combine_messages; use crate::ui::Ui; diff --git a/cli/src/commands/untrack.rs b/cli/src/commands/untrack.rs index 449724468f..4815d736c8 100644 --- a/cli/src/commands/untrack.rs +++ b/cli/src/commands/untrack.rs @@ -22,7 +22,8 @@ use jj_lib::working_copy::SnapshotOptions; use tracing::instrument; use crate::cli_util::CommandHelper; -use crate::command_error::{user_error_with_hint, CommandError}; +use crate::command_error::user_error_with_hint; +use crate::command_error::CommandError; use crate::ui::Ui; /// Stop tracking specified paths in the working copy diff --git a/cli/src/commands/util.rs b/cli/src/commands/util.rs index aa85f0c067..e60e1cd941 100644 --- a/cli/src/commands/util.rs +++ b/cli/src/commands/util.rs @@ -14,14 +14,17 @@ use std::io::Write; use std::slice; -use std::time::{Duration, SystemTime}; +use std::time::Duration; +use std::time::SystemTime; -use clap::{Command, Subcommand}; +use clap::Command; +use clap::Subcommand; use jj_lib::repo::Repo; use tracing::instrument; use crate::cli_util::CommandHelper; -use crate::command_error::{user_error, CommandError}; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Infrequently used commands such as for generating shell completions @@ -229,7 +232,8 @@ fn cmd_util_config_schema( impl ShellCompletion { fn generate(&self, cmd: &mut Command) -> Vec { - use clap_complete::{generate, Shell}; + use clap_complete::generate; + use clap_complete::Shell; use clap_complete_nushell::Nushell; let mut buf = Vec::new(); diff --git a/cli/src/commands/workspace/add.rs b/cli/src/commands/workspace/add.rs index 62dc4604fc..5a09947ae8 100644 --- a/cli/src/commands/workspace/add.rs +++ b/cli/src/commands/workspace/add.rs @@ -24,8 +24,11 @@ use jj_lib::rewrite::merge_commit_trees; use jj_lib::workspace::Workspace; use tracing::instrument; -use crate::cli_util::{CommandHelper, RevisionArg}; -use crate::command_error::{internal_error_with_message, user_error, CommandError}; +use crate::cli_util::CommandHelper; +use crate::cli_util::RevisionArg; +use crate::command_error::internal_error_with_message; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Add a workspace diff --git a/cli/src/commands/workspace/forget.rs b/cli/src/commands/workspace/forget.rs index 38bdd5f594..204ad76388 100644 --- a/cli/src/commands/workspace/forget.rs +++ b/cli/src/commands/workspace/forget.rs @@ -17,7 +17,8 @@ use jj_lib::op_store::WorkspaceId; use tracing::instrument; use crate::cli_util::CommandHelper; -use crate::command_error::{user_error, CommandError}; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Stop tracking a workspace's working-copy commit in the repo diff --git a/cli/src/commands/workspace/mod.rs b/cli/src/commands/workspace/mod.rs index efc50ae14d..37dacefcda 100644 --- a/cli/src/commands/workspace/mod.rs +++ b/cli/src/commands/workspace/mod.rs @@ -21,11 +21,16 @@ mod update_stale; use clap::Subcommand; use tracing::instrument; -use self::add::{cmd_workspace_add, WorkspaceAddArgs}; -use self::forget::{cmd_workspace_forget, WorkspaceForgetArgs}; -use self::list::{cmd_workspace_list, WorkspaceListArgs}; -use self::root::{cmd_workspace_root, WorkspaceRootArgs}; -use self::update_stale::{cmd_workspace_update_stale, WorkspaceUpdateStaleArgs}; +use self::add::cmd_workspace_add; +use self::add::WorkspaceAddArgs; +use self::forget::cmd_workspace_forget; +use self::forget::WorkspaceForgetArgs; +use self::list::cmd_workspace_list; +use self::list::WorkspaceListArgs; +use self::root::cmd_workspace_root; +use self::root::WorkspaceRootArgs; +use self::update_stale::cmd_workspace_update_stale; +use self::update_stale::WorkspaceUpdateStaleArgs; use crate::cli_util::CommandHelper; use crate::command_error::CommandError; use crate::ui::Ui; diff --git a/cli/src/commands/workspace/root.rs b/cli/src/commands/workspace/root.rs index 4b11e4612d..f6b2bc0984 100644 --- a/cli/src/commands/workspace/root.rs +++ b/cli/src/commands/workspace/root.rs @@ -17,7 +17,8 @@ use std::io::Write; use tracing::instrument; use crate::cli_util::CommandHelper; -use crate::command_error::{user_error, CommandError}; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Show the current workspace root directory diff --git a/cli/src/commands/workspace/update_stale.rs b/cli/src/commands/workspace/update_stale.rs index e528069a22..e5a395230b 100644 --- a/cli/src/commands/workspace/update_stale.rs +++ b/cli/src/commands/workspace/update_stale.rs @@ -17,14 +17,19 @@ use std::sync::Arc; use jj_lib::object_id::ObjectId; use jj_lib::op_store::OpStoreError; use jj_lib::operation::Operation; -use jj_lib::repo::{ReadonlyRepo, Repo}; +use jj_lib::repo::ReadonlyRepo; +use jj_lib::repo::Repo; use tracing::instrument; -use crate::cli_util::{ - check_stale_working_copy, print_checkout_stats, short_commit_hash, CommandHelper, - WorkingCopyFreshness, WorkspaceCommandHelper, -}; -use crate::command_error::{internal_error_with_message, user_error, CommandError}; +use crate::cli_util::check_stale_working_copy; +use crate::cli_util::print_checkout_stats; +use crate::cli_util::short_commit_hash; +use crate::cli_util::CommandHelper; +use crate::cli_util::WorkingCopyFreshness; +use crate::cli_util::WorkspaceCommandHelper; +use crate::command_error::internal_error_with_message; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; /// Update a workspace that has become stale diff --git a/cli/src/commit_templater.rs b/cli/src/commit_templater.rs index 1883e12109..fac20b4055 100644 --- a/cli/src/commit_templater.rs +++ b/cli/src/commit_templater.rs @@ -20,37 +20,59 @@ use std::rc::Rc; use futures::stream::BoxStream; use itertools::Itertools as _; -use jj_lib::backend::{BackendResult, ChangeId, CommitId}; +use jj_lib::backend::BackendResult; +use jj_lib::backend::ChangeId; +use jj_lib::backend::CommitId; use jj_lib::commit::Commit; -use jj_lib::copies::{CopiesTreeDiffEntry, CopyRecords}; +use jj_lib::copies::CopiesTreeDiffEntry; +use jj_lib::copies::CopyRecords; use jj_lib::extensions_map::ExtensionsMap; -use jj_lib::fileset::{self, FilesetExpression}; +use jj_lib::fileset::FilesetExpression; +use jj_lib::fileset::{self}; use jj_lib::git; use jj_lib::hex_util::to_reverse_hex; use jj_lib::id_prefix::IdPrefixContext; use jj_lib::matchers::Matcher; use jj_lib::merged_tree::MergedTree; use jj_lib::object_id::ObjectId as _; -use jj_lib::op_store::{RefTarget, RemoteRef, WorkspaceId}; +use jj_lib::op_store::RefTarget; +use jj_lib::op_store::RemoteRef; +use jj_lib::op_store::WorkspaceId; use jj_lib::repo::Repo; use jj_lib::repo_path::RepoPathUiConverter; -use jj_lib::revset::{self, Revset, RevsetExpression, RevsetModifier, RevsetParseContext}; +use jj_lib::revset::Revset; +use jj_lib::revset::RevsetExpression; +use jj_lib::revset::RevsetModifier; +use jj_lib::revset::RevsetParseContext; +use jj_lib::revset::{self}; use jj_lib::store::Store; use once_cell::unsync::OnceCell; +use crate::diff_util; use crate::formatter::Formatter; -use crate::template_builder::{ - self, merge_fn_map, BuildContext, CoreTemplateBuildFnTable, CoreTemplatePropertyKind, - IntoTemplateProperty, TemplateBuildMethodFnMap, TemplateLanguage, -}; -use crate::template_parser::{ - self, ExpressionNode, FunctionCallNode, TemplateParseError, TemplateParseResult, -}; -use crate::templater::{ - self, PlainTextFormattedProperty, SizeHint, Template, TemplateFormatter, TemplateProperty, - TemplatePropertyError, TemplatePropertyExt as _, -}; -use crate::{diff_util, revset_util, text_util}; +use crate::revset_util; +use crate::template_builder::merge_fn_map; +use crate::template_builder::BuildContext; +use crate::template_builder::CoreTemplateBuildFnTable; +use crate::template_builder::CoreTemplatePropertyKind; +use crate::template_builder::IntoTemplateProperty; +use crate::template_builder::TemplateBuildMethodFnMap; +use crate::template_builder::TemplateLanguage; +use crate::template_builder::{self}; +use crate::template_parser::ExpressionNode; +use crate::template_parser::FunctionCallNode; +use crate::template_parser::TemplateParseError; +use crate::template_parser::TemplateParseResult; +use crate::template_parser::{self}; +use crate::templater::PlainTextFormattedProperty; +use crate::templater::SizeHint; +use crate::templater::Template; +use crate::templater::TemplateFormatter; +use crate::templater::TemplateProperty; +use crate::templater::TemplatePropertyError; +use crate::templater::TemplatePropertyExt as _; +use crate::templater::{self}; +use crate::text_util; pub trait CommitTemplateLanguageExtension { fn build_fn_table<'repo>(&self) -> CommitTemplateBuildFnTable<'repo>; diff --git a/cli/src/config.rs b/cli/src/config.rs index f51c032f5f..eebcaac999 100644 --- a/cli/src/config.rs +++ b/cli/src/config.rs @@ -13,20 +13,27 @@ // limitations under the License. use std::borrow::Cow; -use std::collections::{HashMap, HashSet}; -use std::path::{Path, PathBuf}; +use std::collections::HashMap; +use std::collections::HashSet; +use std::env; +use std::fmt; +use std::path::Path; +use std::path::PathBuf; use std::process::Command; +use std::slice; use std::str::FromStr; -use std::{env, fmt, slice}; use config::Source; use itertools::Itertools; use jj_lib::settings::ConfigResultExt as _; -use regex::{Captures, Regex}; +use regex::Captures; +use regex::Regex; use thiserror::Error; use tracing::instrument; -use crate::command_error::{user_error, user_error_with_message, CommandError}; +use crate::command_error::user_error; +use crate::command_error::user_error_with_message; +use crate::command_error::CommandError; /// Parses a TOML value expression. Interprets the given value as string if it /// can't be parsed. diff --git a/cli/src/description_util.rs b/cli/src/description_util.rs index 1c3663c9b1..ce5199e3e4 100644 --- a/cli/src/description_util.rs +++ b/cli/src/description_util.rs @@ -11,7 +11,9 @@ use jj_lib::repo::ReadonlyRepo; use jj_lib::settings::UserSettings; use thiserror::Error; -use crate::cli_util::{edit_temp_file, short_commit_hash, WorkspaceCommandTransaction}; +use crate::cli_util::edit_temp_file; +use crate::cli_util::short_commit_hash; +use crate::cli_util::WorkspaceCommandTransaction; use crate::command_error::CommandError; use crate::formatter::PlainTextFormatter; use crate::text_util; diff --git a/cli/src/diff_util.rs b/cli/src/diff_util.rs index 63a841ecd8..46c03228c2 100644 --- a/cli/src/diff_util.rs +++ b/cli/src/diff_util.rs @@ -15,29 +15,42 @@ use std::borrow::Borrow; use std::cmp::max; use std::collections::HashSet; +use std::io; +use std::mem; use std::ops::Range; -use std::path::{Path, PathBuf}; -use std::{io, mem}; +use std::path::Path; +use std::path::PathBuf; use futures::executor::block_on_stream; use futures::stream::BoxStream; use futures::StreamExt; use itertools::Itertools; -use jj_lib::backend::{BackendError, BackendResult, CommitId, CopyRecord, TreeValue}; +use jj_lib::backend::BackendError; +use jj_lib::backend::BackendResult; +use jj_lib::backend::CommitId; +use jj_lib::backend::CopyRecord; +use jj_lib::backend::TreeValue; use jj_lib::commit::Commit; -use jj_lib::conflicts::{ - materialized_diff_stream, MaterializedTreeDiffEntry, MaterializedTreeValue, -}; -use jj_lib::copies::{CopiesTreeDiffEntry, CopyRecords}; -use jj_lib::diff::{Diff, DiffHunk}; -use jj_lib::files::{DiffLine, DiffLineHunkSide, DiffLineIterator, DiffLineNumber}; +use jj_lib::conflicts::materialized_diff_stream; +use jj_lib::conflicts::MaterializedTreeDiffEntry; +use jj_lib::conflicts::MaterializedTreeValue; +use jj_lib::copies::CopiesTreeDiffEntry; +use jj_lib::copies::CopyRecords; +use jj_lib::diff::Diff; +use jj_lib::diff::DiffHunk; +use jj_lib::files::DiffLine; +use jj_lib::files::DiffLineHunkSide; +use jj_lib::files::DiffLineIterator; +use jj_lib::files::DiffLineNumber; use jj_lib::matchers::Matcher; use jj_lib::merge::MergedTreeValue; use jj_lib::merged_tree::MergedTree; use jj_lib::object_id::ObjectId; use jj_lib::repo::Repo; -use jj_lib::repo_path::{RepoPath, RepoPathUiConverter}; -use jj_lib::settings::{ConfigResultExt as _, UserSettings}; +use jj_lib::repo_path::RepoPath; +use jj_lib::repo_path::RepoPathUiConverter; +use jj_lib::settings::ConfigResultExt as _; +use jj_lib::settings::UserSettings; use jj_lib::store::Store; use pollster::FutureExt; use thiserror::Error; @@ -46,10 +59,13 @@ use unicode_width::UnicodeWidthStr as _; use crate::config::CommandNameAndArgs; use crate::formatter::Formatter; -use crate::merge_tools::{ - self, generate_diff, invoke_external_diff, new_utf8_temp_dir, DiffGenerateError, DiffToolMode, - ExternalMergeTool, -}; +use crate::merge_tools::generate_diff; +use crate::merge_tools::invoke_external_diff; +use crate::merge_tools::new_utf8_temp_dir; +use crate::merge_tools::DiffGenerateError; +use crate::merge_tools::DiffToolMode; +use crate::merge_tools::ExternalMergeTool; +use crate::merge_tools::{self}; use crate::text_util; use crate::ui::Ui; diff --git a/cli/src/formatter.rs b/cli/src/formatter.rs index d6d7ddfce4..f487df84da 100644 --- a/cli/src/formatter.rs +++ b/cli/src/formatter.rs @@ -14,13 +14,20 @@ use std::borrow::BorrowMut; use std::collections::HashMap; -use std::io::{Error, Write}; +use std::fmt; +use std::io; +use std::io::Error; +use std::io::Write; +use std::mem; use std::ops::Range; use std::sync::Arc; -use std::{fmt, io, mem}; use crossterm::queue; -use crossterm::style::{Attribute, Color, SetAttribute, SetBackgroundColor, SetForegroundColor}; +use crossterm::style::Attribute; +use crossterm::style::Color; +use crossterm::style::SetAttribute; +use crossterm::style::SetBackgroundColor; +use crossterm::style::SetForegroundColor; use itertools::Itertools; // Lets the caller label strings and translates the labels to colors diff --git a/cli/src/generic_templater.rs b/cli/src/generic_templater.rs index 71d30779c4..39305a77c8 100644 --- a/cli/src/generic_templater.rs +++ b/cli/src/generic_templater.rs @@ -14,12 +14,17 @@ use std::collections::HashMap; -use crate::template_builder::{ - self, BuildContext, CoreTemplateBuildFnTable, CoreTemplatePropertyKind, IntoTemplateProperty, - TemplateLanguage, -}; -use crate::template_parser::{self, FunctionCallNode, TemplateParseResult}; -use crate::templater::{Template, TemplateProperty}; +use crate::template_builder::BuildContext; +use crate::template_builder::CoreTemplateBuildFnTable; +use crate::template_builder::CoreTemplatePropertyKind; +use crate::template_builder::IntoTemplateProperty; +use crate::template_builder::TemplateLanguage; +use crate::template_builder::{self}; +use crate::template_parser::FunctionCallNode; +use crate::template_parser::TemplateParseResult; +use crate::template_parser::{self}; +use crate::templater::Template; +use crate::templater::TemplateProperty; /// General-purpose template language for basic value types. /// diff --git a/cli/src/git_util.rs b/cli/src/git_util.rs index 00f5383d9a..7d3eca200d 100644 --- a/cli/src/git_util.rs +++ b/cli/src/git_util.rs @@ -14,22 +14,32 @@ //! Git utilities shared by various commands. -use std::io::{Read, Write}; -use std::path::{Path, PathBuf}; +use std::error; +use std::io::Read; +use std::io::Write; +use std::iter; +use std::path::Path; +use std::path::PathBuf; use std::process::Stdio; use std::time::Instant; -use std::{error, iter}; use itertools::Itertools; -use jj_lib::git::{self, FailedRefExport, FailedRefExportReason, GitImportStats, RefName}; +use jj_lib::git::FailedRefExport; +use jj_lib::git::FailedRefExportReason; +use jj_lib::git::GitImportStats; +use jj_lib::git::RefName; +use jj_lib::git::{self}; use jj_lib::git_backend::GitBackend; -use jj_lib::op_store::{RefTarget, RemoteRef}; -use jj_lib::repo::{ReadonlyRepo, Repo}; +use jj_lib::op_store::RefTarget; +use jj_lib::op_store::RemoteRef; +use jj_lib::repo::ReadonlyRepo; +use jj_lib::repo::Repo; use jj_lib::store::Store; use jj_lib::workspace::Workspace; use unicode_width::UnicodeWidthStr; -use crate::command_error::{user_error, CommandError}; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::formatter::Formatter; use crate::progress::Progress; use crate::ui::Ui; diff --git a/cli/src/graphlog.rs b/cli/src/graphlog.rs index d92c94c4bd..a5b92b91fa 100644 --- a/cli/src/graphlog.rs +++ b/cli/src/graphlog.rs @@ -18,7 +18,9 @@ use std::io::Write; use itertools::Itertools; use jj_lib::settings::UserSettings; -use renderdag::{Ancestor, GraphRowRenderer, Renderer}; +use renderdag::Ancestor; +use renderdag::GraphRowRenderer; +use renderdag::Renderer; #[derive(Debug, Clone, PartialEq, Eq)] // An edge to another node in the graph diff --git a/cli/src/merge_tools/builtin.rs b/cli/src/merge_tools/builtin.rs index 5aa8cc5e85..c7be2993f8 100644 --- a/cli/src/merge_tools/builtin.rs +++ b/cli/src/merge_tools/builtin.rs @@ -2,17 +2,30 @@ use std::borrow::Cow; use std::path::Path; use std::sync::Arc; -use futures::{StreamExt, TryFutureExt, TryStreamExt}; +use futures::StreamExt; +use futures::TryFutureExt; +use futures::TryStreamExt; use itertools::Itertools; -use jj_lib::backend::{BackendError, BackendResult, FileId, MergedTreeId, TreeValue}; -use jj_lib::conflicts::{materialize_tree_value, MaterializedTreeValue}; -use jj_lib::diff::{Diff, DiffHunk}; -use jj_lib::files::{self, ContentHunk, MergeResult}; +use jj_lib::backend::BackendError; +use jj_lib::backend::BackendResult; +use jj_lib::backend::FileId; +use jj_lib::backend::MergedTreeId; +use jj_lib::backend::TreeValue; +use jj_lib::conflicts::materialize_tree_value; +use jj_lib::conflicts::MaterializedTreeValue; +use jj_lib::diff::Diff; +use jj_lib::diff::DiffHunk; +use jj_lib::files::ContentHunk; +use jj_lib::files::MergeResult; +use jj_lib::files::{self}; use jj_lib::matchers::Matcher; use jj_lib::merge::Merge; -use jj_lib::merged_tree::{MergedTree, MergedTreeBuilder, TreeDiffEntry}; +use jj_lib::merged_tree::MergedTree; +use jj_lib::merged_tree::MergedTreeBuilder; +use jj_lib::merged_tree::TreeDiffEntry; use jj_lib::object_id::ObjectId; -use jj_lib::repo_path::{RepoPath, RepoPathBuf}; +use jj_lib::repo_path::RepoPath; +use jj_lib::repo_path::RepoPathBuf; use jj_lib::store::Store; use pollster::FutureExt; use thiserror::Error; diff --git a/cli/src/merge_tools/diff_working_copies.rs b/cli/src/merge_tools/diff_working_copies.rs index 61a2777a95..4beda25a52 100644 --- a/cli/src/merge_tools/diff_working_copies.rs +++ b/cli/src/merge_tools/diff_working_copies.rs @@ -1,19 +1,24 @@ use std::collections::HashMap; use std::fs::File; -use std::io::{self, Write}; -use std::path::{Path, PathBuf}; +use std::io::Write; +use std::io::{self}; +use std::path::Path; +use std::path::PathBuf; use std::sync::Arc; use futures::StreamExt; use jj_lib::backend::MergedTreeId; use jj_lib::fsmonitor::FsmonitorSettings; use jj_lib::gitignore::GitIgnoreFile; -use jj_lib::local_working_copy::{TreeState, TreeStateError}; +use jj_lib::local_working_copy::TreeState; +use jj_lib::local_working_copy::TreeStateError; use jj_lib::matchers::Matcher; -use jj_lib::merged_tree::{MergedTree, TreeDiffEntry}; +use jj_lib::merged_tree::MergedTree; +use jj_lib::merged_tree::TreeDiffEntry; use jj_lib::repo_path::RepoPathBuf; use jj_lib::store::Store; -use jj_lib::working_copy::{CheckoutError, SnapshotOptions}; +use jj_lib::working_copy::CheckoutError; +use jj_lib::working_copy::SnapshotOptions; use pollster::FutureExt; use tempfile::TempDir; use thiserror::Error; diff --git a/cli/src/merge_tools/external.rs b/cli/src/merge_tools/external.rs index 3025f376db..6ddffcbe04 100644 --- a/cli/src/merge_tools/external.rs +++ b/cli/src/merge_tools/external.rs @@ -1,24 +1,38 @@ use std::collections::HashMap; -use std::io::{self, Write}; -use std::process::{Command, ExitStatus, Stdio}; +use std::io::Write; +use std::io::{self}; +use std::process::Command; +use std::process::ExitStatus; +use std::process::Stdio; use std::sync::Arc; use itertools::Itertools; -use jj_lib::backend::{FileId, MergedTreeId, TreeValue}; -use jj_lib::conflicts::{self, materialize_merge_result}; +use jj_lib::backend::FileId; +use jj_lib::backend::MergedTreeId; +use jj_lib::backend::TreeValue; +use jj_lib::conflicts::materialize_merge_result; +use jj_lib::conflicts::{self}; use jj_lib::gitignore::GitIgnoreFile; use jj_lib::matchers::Matcher; -use jj_lib::merge::{Merge, MergedTreeValue}; -use jj_lib::merged_tree::{MergedTree, MergedTreeBuilder}; +use jj_lib::merge::Merge; +use jj_lib::merge::MergedTreeValue; +use jj_lib::merged_tree::MergedTree; +use jj_lib::merged_tree::MergedTreeBuilder; use jj_lib::repo_path::RepoPath; use pollster::FutureExt; use thiserror::Error; -use super::diff_working_copies::{ - check_out_trees, new_utf8_temp_dir, set_readonly_recursively, DiffEditWorkingCopies, DiffSide, -}; -use super::{ConflictResolveError, DiffEditError, DiffGenerateError}; -use crate::config::{find_all_variables, interpolate_variables, CommandNameAndArgs}; +use super::diff_working_copies::check_out_trees; +use super::diff_working_copies::new_utf8_temp_dir; +use super::diff_working_copies::set_readonly_recursively; +use super::diff_working_copies::DiffEditWorkingCopies; +use super::diff_working_copies::DiffSide; +use super::ConflictResolveError; +use super::DiffEditError; +use super::DiffGenerateError; +use crate::config::find_all_variables; +use crate::config::interpolate_variables; +use crate::config::CommandNameAndArgs; use crate::ui::Ui; /// Merge/diff tool loaded from the settings. diff --git a/cli/src/merge_tools/mod.rs b/cli/src/merge_tools/mod.rs index e73304e73b..c35f1e0da4 100644 --- a/cli/src/merge_tools/mod.rs +++ b/cli/src/merge_tools/mod.rs @@ -24,17 +24,25 @@ use jj_lib::conflicts::extract_as_single_hunk; use jj_lib::gitignore::GitIgnoreFile; use jj_lib::matchers::Matcher; use jj_lib::merged_tree::MergedTree; -use jj_lib::repo_path::{RepoPath, RepoPathBuf}; -use jj_lib::settings::{ConfigResultExt as _, UserSettings}; +use jj_lib::repo_path::RepoPath; +use jj_lib::repo_path::RepoPathBuf; +use jj_lib::settings::ConfigResultExt as _; +use jj_lib::settings::UserSettings; use jj_lib::working_copy::SnapshotError; use pollster::FutureExt; use thiserror::Error; -use self::builtin::{edit_diff_builtin, edit_merge_builtin, BuiltinToolError}; +use self::builtin::edit_diff_builtin; +use self::builtin::edit_merge_builtin; +use self::builtin::BuiltinToolError; pub(crate) use self::diff_working_copies::new_utf8_temp_dir; use self::diff_working_copies::DiffCheckoutError; -use self::external::{edit_diff_external, ExternalToolError}; -pub use self::external::{generate_diff, invoke_external_diff, DiffToolMode, ExternalMergeTool}; +use self::external::edit_diff_external; +pub use self::external::generate_diff; +pub use self::external::invoke_external_diff; +pub use self::external::DiffToolMode; +pub use self::external::ExternalMergeTool; +use self::external::ExternalToolError; use crate::config::CommandNameAndArgs; use crate::ui::Ui; diff --git a/cli/src/movement_util.rs b/cli/src/movement_util.rs index be4bdae257..8c18714199 100644 --- a/cli/src/movement_util.rs +++ b/cli/src/movement_util.rs @@ -19,10 +19,15 @@ use itertools::Itertools; use jj_lib::backend::CommitId; use jj_lib::commit::Commit; use jj_lib::repo::Repo; -use jj_lib::revset::{RevsetExpression, RevsetFilterPredicate, RevsetIteratorExt}; - -use crate::cli_util::{short_commit_hash, CommandHelper, WorkspaceCommandHelper}; -use crate::command_error::{user_error, CommandError}; +use jj_lib::revset::RevsetExpression; +use jj_lib::revset::RevsetFilterPredicate; +use jj_lib::revset::RevsetIteratorExt; + +use crate::cli_util::short_commit_hash; +use crate::cli_util::CommandHelper; +use crate::cli_util::WorkspaceCommandHelper; +use crate::command_error::user_error; +use crate::command_error::CommandError; use crate::ui::Ui; #[derive(Clone, Debug, Eq, PartialEq)] diff --git a/cli/src/operation_templater.rs b/cli/src/operation_templater.rs index 28597ffec4..383bec8b40 100644 --- a/cli/src/operation_templater.rs +++ b/cli/src/operation_templater.rs @@ -22,15 +22,23 @@ use jj_lib::object_id::ObjectId; use jj_lib::op_store::OperationId; use jj_lib::operation::Operation; -use crate::template_builder::{ - self, merge_fn_map, BuildContext, CoreTemplateBuildFnTable, CoreTemplatePropertyKind, - IntoTemplateProperty, TemplateBuildMethodFnMap, TemplateLanguage, -}; -use crate::template_parser::{self, FunctionCallNode, TemplateParseResult}; -use crate::templater::{ - PlainTextFormattedProperty, Template, TemplateFormatter, TemplateProperty, - TemplatePropertyExt as _, TimestampRange, -}; +use crate::template_builder::merge_fn_map; +use crate::template_builder::BuildContext; +use crate::template_builder::CoreTemplateBuildFnTable; +use crate::template_builder::CoreTemplatePropertyKind; +use crate::template_builder::IntoTemplateProperty; +use crate::template_builder::TemplateBuildMethodFnMap; +use crate::template_builder::TemplateLanguage; +use crate::template_builder::{self}; +use crate::template_parser::FunctionCallNode; +use crate::template_parser::TemplateParseResult; +use crate::template_parser::{self}; +use crate::templater::PlainTextFormattedProperty; +use crate::templater::Template; +use crate::templater::TemplateFormatter; +use crate::templater::TemplateProperty; +use crate::templater::TemplatePropertyExt as _; +use crate::templater::TimestampRange; pub trait OperationTemplateLanguageExtension { fn build_fn_table(&self) -> OperationTemplateBuildFnTable; diff --git a/cli/src/progress.rs b/cli/src/progress.rs index e67b5e88aa..d24e733be4 100644 --- a/cli/src/progress.rs +++ b/cli/src/progress.rs @@ -1,16 +1,20 @@ use std::io; use std::path::Path; use std::sync::Mutex; -use std::time::{Duration, Instant}; +use std::time::Duration; +use std::time::Instant; -use crossterm::terminal::{Clear, ClearType}; +use crossterm::terminal::Clear; +use crossterm::terminal::ClearType; use jj_lib::fmt_util::binary_prefix; use jj_lib::git; use jj_lib::repo_path::RepoPath; use crate::cleanup_guard::CleanupGuard; use crate::text_util; -use crate::ui::{OutputGuard, ProgressOutput, Ui}; +use crate::ui::OutputGuard; +use crate::ui::ProgressOutput; +use crate::ui::Ui; pub struct Progress { next_print: Instant, diff --git a/cli/src/revset_util.rs b/cli/src/revset_util.rs index 96dfb6d066..de9dbea407 100644 --- a/cli/src/revset_util.rs +++ b/cli/src/revset_util.rs @@ -18,20 +18,31 @@ use std::rc::Rc; use std::sync::Arc; use itertools::Itertools as _; -use jj_lib::backend::{BackendResult, CommitId}; +use jj_lib::backend::BackendResult; +use jj_lib::backend::CommitId; use jj_lib::commit::Commit; use jj_lib::id_prefix::IdPrefixContext; use jj_lib::repo::Repo; -use jj_lib::revset::{ - self, DefaultSymbolResolver, Revset, RevsetAliasesMap, RevsetCommitRef, RevsetEvaluationError, - RevsetExpression, RevsetExtensions, RevsetIteratorExt as _, RevsetParseContext, - RevsetParseError, RevsetResolutionError, SymbolResolverExtension, -}; +use jj_lib::revset::DefaultSymbolResolver; +use jj_lib::revset::Revset; +use jj_lib::revset::RevsetAliasesMap; +use jj_lib::revset::RevsetCommitRef; +use jj_lib::revset::RevsetEvaluationError; +use jj_lib::revset::RevsetExpression; +use jj_lib::revset::RevsetExtensions; +use jj_lib::revset::RevsetIteratorExt as _; +use jj_lib::revset::RevsetParseContext; +use jj_lib::revset::RevsetParseError; +use jj_lib::revset::RevsetResolutionError; +use jj_lib::revset::SymbolResolverExtension; +use jj_lib::revset::{self}; use jj_lib::settings::ConfigResultExt as _; use thiserror::Error; -use crate::command_error::{user_error, CommandError}; -use crate::config::{ConfigSource, LayeredConfigs}; +use crate::command_error::user_error; +use crate::command_error::CommandError; +use crate::config::ConfigSource; +use crate::config::LayeredConfigs; use crate::formatter::Formatter; use crate::templater::TemplateRenderer; use crate::ui::Ui; diff --git a/cli/src/template_builder.rs b/cli/src/template_builder.rs index d7fdd08563..bfc77f71c0 100644 --- a/cli/src/template_builder.rs +++ b/cli/src/template_builder.rs @@ -15,20 +15,40 @@ use std::collections::HashMap; use itertools::Itertools as _; -use jj_lib::backend::{Signature, Timestamp}; +use jj_lib::backend::Signature; +use jj_lib::backend::Timestamp; use jj_lib::dsl_util::AliasExpandError as _; -use crate::template_parser::{ - self, BinaryOp, ExpressionKind, ExpressionNode, FunctionCallNode, TemplateAliasesMap, - TemplateParseError, TemplateParseErrorKind, TemplateParseResult, UnaryOp, -}; -use crate::templater::{ - CoalesceTemplate, ConcatTemplate, ConditionalTemplate, LabelTemplate, ListPropertyTemplate, - ListTemplate, Literal, PlainTextFormattedProperty, PropertyPlaceholder, ReformatTemplate, - SeparateTemplate, SizeHint, Template, TemplateProperty, TemplatePropertyError, - TemplatePropertyExt as _, TemplateRenderer, TimestampRange, -}; -use crate::{text_util, time_util}; +use crate::template_parser::BinaryOp; +use crate::template_parser::ExpressionKind; +use crate::template_parser::ExpressionNode; +use crate::template_parser::FunctionCallNode; +use crate::template_parser::TemplateAliasesMap; +use crate::template_parser::TemplateParseError; +use crate::template_parser::TemplateParseErrorKind; +use crate::template_parser::TemplateParseResult; +use crate::template_parser::UnaryOp; +use crate::template_parser::{self}; +use crate::templater::CoalesceTemplate; +use crate::templater::ConcatTemplate; +use crate::templater::ConditionalTemplate; +use crate::templater::LabelTemplate; +use crate::templater::ListPropertyTemplate; +use crate::templater::ListTemplate; +use crate::templater::Literal; +use crate::templater::PlainTextFormattedProperty; +use crate::templater::PropertyPlaceholder; +use crate::templater::ReformatTemplate; +use crate::templater::SeparateTemplate; +use crate::templater::SizeHint; +use crate::templater::Template; +use crate::templater::TemplateProperty; +use crate::templater::TemplatePropertyError; +use crate::templater::TemplatePropertyExt as _; +use crate::templater::TemplateRenderer; +use crate::templater::TimestampRange; +use crate::text_util; +use crate::time_util; /// Callbacks to build language-specific evaluation objects from AST nodes. pub trait TemplateLanguage<'a> { @@ -121,7 +141,8 @@ macro_rules! impl_wrap_property_fns { }; } -pub(crate) use {impl_core_wrap_property_fns, impl_wrap_property_fns}; +pub(crate) use impl_core_wrap_property_fns; +pub(crate) use impl_wrap_property_fns; /// Provides access to basic template property types. pub trait IntoTemplateProperty<'a> { @@ -1246,7 +1267,8 @@ mod tests { use jj_lib::backend::MillisSinceEpoch; use super::*; - use crate::formatter::{self, ColorFormatter}; + use crate::formatter::ColorFormatter; + use crate::formatter::{self}; use crate::generic_templater::GenericTemplateLanguage; type L = GenericTemplateLanguage<'static, ()>; diff --git a/cli/src/template_parser.rs b/cli/src/template_parser.rs index 99f418b0e8..a023f4db47 100644 --- a/cli/src/template_parser.rs +++ b/cli/src/template_parser.rs @@ -13,17 +13,29 @@ // limitations under the License. use std::collections::HashMap; -use std::{error, mem}; +use std::error; +use std::mem; use itertools::Itertools as _; -use jj_lib::dsl_util::{ - self, collect_similar, AliasDeclaration, AliasDeclarationParser, AliasDefinitionParser, - AliasExpandError, AliasExpandableExpression, AliasId, AliasesMap, ExpressionFolder, - FoldableExpression, InvalidArguments, StringLiteralParser, -}; +use jj_lib::dsl_util::collect_similar; +use jj_lib::dsl_util::AliasDeclaration; +use jj_lib::dsl_util::AliasDeclarationParser; +use jj_lib::dsl_util::AliasDefinitionParser; +use jj_lib::dsl_util::AliasExpandError; +use jj_lib::dsl_util::AliasExpandableExpression; +use jj_lib::dsl_util::AliasId; +use jj_lib::dsl_util::AliasesMap; +use jj_lib::dsl_util::ExpressionFolder; +use jj_lib::dsl_util::FoldableExpression; +use jj_lib::dsl_util::InvalidArguments; +use jj_lib::dsl_util::StringLiteralParser; +use jj_lib::dsl_util::{self}; use once_cell::sync::Lazy; -use pest::iterators::{Pair, Pairs}; -use pest::pratt_parser::{Assoc, Op, PrattParser}; +use pest::iterators::Pair; +use pest::iterators::Pairs; +use pest::pratt_parser::Assoc; +use pest::pratt_parser::Op; +use pest::pratt_parser::PrattParser; use pest::Parser; use pest_derive::Parser; use thiserror::Error; diff --git a/cli/src/templater.rs b/cli/src/templater.rs index b0b0f2cad2..a8332fd9ae 100644 --- a/cli/src/templater.rs +++ b/cli/src/templater.rs @@ -13,12 +13,19 @@ // limitations under the License. use std::cell::RefCell; +use std::error; +use std::fmt; +use std::io; +use std::iter; use std::rc::Rc; -use std::{error, fmt, io, iter}; -use jj_lib::backend::{Signature, Timestamp}; +use jj_lib::backend::Signature; +use jj_lib::backend::Timestamp; -use crate::formatter::{FormatRecorder, Formatter, LabeledWriter, PlainTextFormatter}; +use crate::formatter::FormatRecorder; +use crate::formatter::Formatter; +use crate::formatter::LabeledWriter; +use crate::formatter::PlainTextFormatter; use crate::time_util; /// Represents printable type or compiled template containing placeholder value. diff --git a/cli/src/text_util.rs b/cli/src/text_util.rs index 59874a0a47..26ab535826 100644 --- a/cli/src/text_util.rs +++ b/cli/src/text_util.rs @@ -13,11 +13,13 @@ // limitations under the License. use std::borrow::Cow; -use std::{cmp, io}; +use std::cmp; +use std::io; use unicode_width::UnicodeWidthChar as _; -use crate::formatter::{FormatRecorder, Formatter}; +use crate::formatter::FormatRecorder; +use crate::formatter::Formatter; pub fn complete_newline(s: impl Into) -> String { let mut s = s.into(); @@ -264,7 +266,8 @@ mod tests { use std::io::Write as _; use super::*; - use crate::formatter::{ColorFormatter, PlainTextFormatter}; + use crate::formatter::ColorFormatter; + use crate::formatter::PlainTextFormatter; fn format_colored(write: impl FnOnce(&mut dyn Formatter) -> io::Result<()>) -> String { let config = config::Config::builder() diff --git a/cli/src/time_util.rs b/cli/src/time_util.rs index bf1c4940c1..c505678384 100644 --- a/cli/src/time_util.rs +++ b/cli/src/time_util.rs @@ -1,5 +1,9 @@ use chrono::format::StrftimeItems; -use chrono::{DateTime, FixedOffset, LocalResult, TimeZone, Utc}; +use chrono::DateTime; +use chrono::FixedOffset; +use chrono::LocalResult; +use chrono::TimeZone; +use chrono::Utc; use jj_lib::backend::Timestamp; use once_cell::sync::Lazy; use thiserror::Error; diff --git a/cli/src/ui.rs b/cli/src/ui.rs index c7c8d99a5e..be604b87d0 100644 --- a/cli/src/ui.rs +++ b/cli/src/ui.rs @@ -12,22 +12,38 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::io::{IsTerminal as _, Stderr, StderrLock, Stdout, StdoutLock, Write}; -use std::process::{Child, ChildStdin, Stdio}; +use std::env; +use std::error; +use std::fmt; +use std::io; +use std::io::IsTerminal as _; +use std::io::Stderr; +use std::io::StderrLock; +use std::io::Stdout; +use std::io::StdoutLock; +use std::io::Write; +use std::iter; +use std::mem; +use std::process::Child; +use std::process::ChildStdin; +use std::process::Stdio; use std::str::FromStr; use std::thread::JoinHandle; -use std::{env, error, fmt, io, iter, mem}; use indoc::indoc; use itertools::Itertools as _; -use minus::{MinusError, Pager as MinusPager}; +use minus::MinusError; +use minus::Pager as MinusPager; use tracing::instrument; -use crate::command_error::{config_error_with_message, CommandError}; +use crate::command_error::config_error_with_message; +use crate::command_error::CommandError; use crate::config::CommandNameAndArgs; -use crate::formatter::{ - Formatter, FormatterFactory, HeadingLabeledWriter, LabeledWriter, PlainTextFormatter, -}; +use crate::formatter::Formatter; +use crate::formatter::FormatterFactory; +use crate::formatter::HeadingLabeledWriter; +use crate::formatter::LabeledWriter; +use crate::formatter::PlainTextFormatter; const BUILTIN_PAGER_NAME: &str = ":builtin"; diff --git a/cli/testing/fake-diff-editor.rs b/cli/testing/fake-diff-editor.rs index f398ff2362..e39824b4b8 100644 --- a/cli/testing/fake-diff-editor.rs +++ b/cli/testing/fake-diff-editor.rs @@ -13,7 +13,8 @@ // limitations under the License. use std::collections::HashSet; -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; use std::process::exit; use clap::Parser; diff --git a/cli/testing/fake-editor.rs b/cli/testing/fake-editor.rs index b215c81902..7e89019aa5 100644 --- a/cli/testing/fake-editor.rs +++ b/cli/testing/fake-editor.rs @@ -12,9 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::env; +use std::fs; use std::path::PathBuf; use std::process::exit; -use std::{env, fs}; use clap::Parser; use itertools::Itertools; diff --git a/cli/testing/fake-formatter.rs b/cli/testing/fake-formatter.rs index a58791d4a6..f0fa6852c3 100644 --- a/cli/testing/fake-formatter.rs +++ b/cli/testing/fake-formatter.rs @@ -17,7 +17,8 @@ use std::io::Write; use std::path::PathBuf; use std::process::ExitCode; -use clap::{arg, Parser}; +use clap::arg; +use clap::Parser; use itertools::Itertools; /// A fake code formatter, useful for testing diff --git a/cli/tests/common/mod.rs b/cli/tests/common/mod.rs index 72f4eb5a51..ea70971639 100644 --- a/cli/tests/common/mod.rs +++ b/cli/tests/common/mod.rs @@ -14,10 +14,12 @@ use std::cell::RefCell; use std::collections::HashMap; -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; use itertools::Itertools as _; -use regex::{Captures, Regex}; +use regex::Captures; +use regex::Regex; use tempfile::TempDir; pub struct TestEnvironment { diff --git a/cli/tests/test_acls.rs b/cli/tests/test_acls.rs index 7fe76232d8..a31c90cf6c 100644 --- a/cli/tests/test_acls.rs +++ b/cli/tests/test_acls.rs @@ -14,7 +14,9 @@ use jj_lib::secret_backend::SecretBackend; -use crate::common::{get_stderr_string, get_stdout_string, TestEnvironment}; +use crate::common::get_stderr_string; +use crate::common::get_stdout_string; +use crate::common::TestEnvironment; #[test] fn test_diff() { diff --git a/cli/tests/test_commit_command.rs b/cli/tests/test_commit_command.rs index 7c752c54c3..4d2a2c95be 100644 --- a/cli/tests/test_commit_command.rs +++ b/cli/tests/test_commit_command.rs @@ -12,7 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; use crate::common::TestEnvironment; diff --git a/cli/tests/test_describe_command.rs b/cli/tests/test_describe_command.rs index 9a01287762..29898c6bba 100644 --- a/cli/tests/test_describe_command.rs +++ b/cli/tests/test_describe_command.rs @@ -12,11 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; use indoc::indoc; -use crate::common::{get_stderr_string, TestEnvironment}; +use crate::common::get_stderr_string; +use crate::common::TestEnvironment; #[test] fn test_describe() { diff --git a/cli/tests/test_diff_command.rs b/cli/tests/test_diff_command.rs index 9d1c34a3ba..20e67376bd 100644 --- a/cli/tests/test_diff_command.rs +++ b/cli/tests/test_diff_command.rs @@ -15,7 +15,9 @@ use indoc::indoc; use itertools::Itertools; -use crate::common::{escaped_fake_diff_editor_path, strip_last_line, TestEnvironment}; +use crate::common::escaped_fake_diff_editor_path; +use crate::common::strip_last_line; +use crate::common::TestEnvironment; #[test] fn test_diff_basic() { diff --git a/cli/tests/test_diffedit_command.rs b/cli/tests/test_diffedit_command.rs index 65d9642222..a2a2780aa1 100644 --- a/cli/tests/test_diffedit_command.rs +++ b/cli/tests/test_diffedit_command.rs @@ -12,7 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::common::{escaped_fake_diff_editor_path, TestEnvironment}; +use crate::common::escaped_fake_diff_editor_path; +use crate::common::TestEnvironment; #[test] fn test_diffedit() { diff --git a/cli/tests/test_git_clone.rs b/cli/tests/test_git_clone.rs index fa54e223ec..6602e525f4 100644 --- a/cli/tests/test_git_clone.rs +++ b/cli/tests/test_git_clone.rs @@ -12,9 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::path::{self, Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; +use std::path::{self}; -use crate::common::{get_stderr_string, get_stdout_string, TestEnvironment}; +use crate::common::get_stderr_string; +use crate::common::get_stdout_string; +use crate::common::TestEnvironment; fn set_up_non_empty_git_repo(git_repo: &git2::Repository) { let signature = diff --git a/cli/tests/test_git_init.rs b/cli/tests/test_git_init.rs index bfa8fd88e9..e46e279c48 100644 --- a/cli/tests/test_git_init.rs +++ b/cli/tests/test_git_init.rs @@ -13,11 +13,13 @@ // limitations under the License. use std::fmt::Write as _; -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; use test_case::test_case; -use crate::common::{strip_last_line, TestEnvironment}; +use crate::common::strip_last_line; +use crate::common::TestEnvironment; fn init_git_repo(git_repo_path: &Path, bare: bool) -> git2::Repository { init_git_repo_with_opts(git_repo_path, git2::RepositoryInitOptions::new().bare(bare)) diff --git a/cli/tests/test_git_private_commits.rs b/cli/tests/test_git_private_commits.rs index 173910635a..3fec135f93 100644 --- a/cli/tests/test_git_private_commits.rs +++ b/cli/tests/test_git_private_commits.rs @@ -12,7 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; use crate::common::TestEnvironment; diff --git a/cli/tests/test_git_push.rs b/cli/tests/test_git_push.rs index 7e3cfe75f1..befa9a2394 100644 --- a/cli/tests/test_git_push.rs +++ b/cli/tests/test_git_push.rs @@ -12,7 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; use crate::common::TestEnvironment; diff --git a/cli/tests/test_global_opts.rs b/cli/tests/test_global_opts.rs index 088c346cf7..78c391235b 100644 --- a/cli/tests/test_global_opts.rs +++ b/cli/tests/test_global_opts.rs @@ -14,7 +14,9 @@ use std::ffi::OsString; -use crate::common::{get_stderr_string, strip_last_line, TestEnvironment}; +use crate::common::get_stderr_string; +use crate::common::strip_last_line; +use crate::common::TestEnvironment; #[test] fn test_non_utf8_arg() { diff --git a/cli/tests/test_init_command.rs b/cli/tests/test_init_command.rs index 1f2d044a2a..221d642de2 100644 --- a/cli/tests/test_init_command.rs +++ b/cli/tests/test_init_command.rs @@ -12,11 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; use test_case::test_case; -use crate::common::{strip_last_line, TestEnvironment}; +use crate::common::strip_last_line; +use crate::common::TestEnvironment; fn init_git_repo(git_repo_path: &Path, bare: bool) -> git2::Repository { init_git_repo_with_opts(git_repo_path, git2::RepositoryInitOptions::new().bare(bare)) diff --git a/cli/tests/test_log_command.rs b/cli/tests/test_log_command.rs index d617bda7a4..fbb44142c1 100644 --- a/cli/tests/test_log_command.rs +++ b/cli/tests/test_log_command.rs @@ -12,7 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::common::{get_stdout_string, TestEnvironment}; +use crate::common::get_stdout_string; +use crate::common::TestEnvironment; #[test] fn test_log_with_empty_revision() { diff --git a/cli/tests/test_move_command.rs b/cli/tests/test_move_command.rs index 385fb7c4d7..ee6c98a727 100644 --- a/cli/tests/test_move_command.rs +++ b/cli/tests/test_move_command.rs @@ -12,7 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; use crate::common::TestEnvironment; diff --git a/cli/tests/test_next_prev_commands.rs b/cli/tests/test_next_prev_commands.rs index 91f539a557..5338bf3853 100644 --- a/cli/tests/test_next_prev_commands.rs +++ b/cli/tests/test_next_prev_commands.rs @@ -15,7 +15,9 @@ use std::path::Path; -use crate::common::{get_stderr_string, get_stdout_string, TestEnvironment}; +use crate::common::get_stderr_string; +use crate::common::get_stdout_string; +use crate::common::TestEnvironment; #[test] fn test_next_simple() { diff --git a/cli/tests/test_obslog_command.rs b/cli/tests/test_obslog_command.rs index 923108debc..fb640d6437 100644 --- a/cli/tests/test_obslog_command.rs +++ b/cli/tests/test_obslog_command.rs @@ -12,7 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::common::{get_stdout_string, TestEnvironment}; +use crate::common::get_stdout_string; +use crate::common::TestEnvironment; #[test] fn test_obslog_with_or_without_diff() { diff --git a/cli/tests/test_operations.rs b/cli/tests/test_operations.rs index 9d2b08c047..19b2e1df43 100644 --- a/cli/tests/test_operations.rs +++ b/cli/tests/test_operations.rs @@ -17,7 +17,9 @@ use std::path::Path; use itertools::Itertools; use regex::Regex; -use crate::common::{get_stdout_string, strip_last_line, TestEnvironment}; +use crate::common::get_stdout_string; +use crate::common::strip_last_line; +use crate::common::TestEnvironment; #[test] fn test_op_log() { diff --git a/cli/tests/test_root.rs b/cli/tests/test_root.rs index 352d73c73c..a84c3b677e 100644 --- a/cli/tests/test_root.rs +++ b/cli/tests/test_root.rs @@ -15,7 +15,8 @@ use std::path::Path; use test_case::test_case; -use testutils::{TestRepoBackend, TestWorkspace}; +use testutils::TestRepoBackend; +use testutils::TestWorkspace; use crate::common::TestEnvironment; diff --git a/cli/tests/test_split_command.rs b/cli/tests/test_split_command.rs index b4a9116ea4..fde34aa4a3 100644 --- a/cli/tests/test_split_command.rs +++ b/cli/tests/test_split_command.rs @@ -12,7 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; use crate::common::TestEnvironment; diff --git a/cli/tests/test_squash_command.rs b/cli/tests/test_squash_command.rs index 5544454687..6b23345e13 100644 --- a/cli/tests/test_squash_command.rs +++ b/cli/tests/test_squash_command.rs @@ -12,7 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; use crate::common::TestEnvironment; diff --git a/cli/tests/test_unsquash_command.rs b/cli/tests/test_unsquash_command.rs index 4dcb6819e9..1bedd3abdb 100644 --- a/cli/tests/test_unsquash_command.rs +++ b/cli/tests/test_unsquash_command.rs @@ -12,7 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; use crate::common::TestEnvironment; diff --git a/lib/benches/diff_bench.rs b/lib/benches/diff_bench.rs index 35e39a2324..2987760bee 100644 --- a/lib/benches/diff_bench.rs +++ b/lib/benches/diff_bench.rs @@ -1,4 +1,7 @@ -use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; +use criterion::criterion_group; +use criterion::criterion_main; +use criterion::BenchmarkId; +use criterion::Criterion; use jj_lib::diff; fn unchanged_lines(count: usize) -> (String, String) { diff --git a/lib/proc-macros/src/content_hash.rs b/lib/proc-macros/src/content_hash.rs index 0b6aaa4ecb..b8486e3c55 100644 --- a/lib/proc-macros/src/content_hash.rs +++ b/lib/proc-macros/src/content_hash.rs @@ -1,7 +1,17 @@ -use proc_macro2::{Ident, TokenStream}; -use quote::{format_ident, quote, quote_spanned}; +use proc_macro2::Ident; +use proc_macro2::TokenStream; +use quote::format_ident; +use quote::quote; +use quote::quote_spanned; +use syn::parse_quote; use syn::spanned::Spanned; -use syn::{parse_quote, Data, Field, Fields, GenericParam, Generics, Index, Type}; +use syn::Data; +use syn::Field; +use syn::Fields; +use syn::GenericParam; +use syn::Generics; +use syn::Index; +use syn::Type; pub fn add_trait_bounds(mut generics: Generics) -> Generics { for param in &mut generics.params { diff --git a/lib/proc-macros/src/lib.rs b/lib/proc-macros/src/lib.rs index 2505e83b97..766141abb3 100644 --- a/lib/proc-macros/src/lib.rs +++ b/lib/proc-macros/src/lib.rs @@ -3,7 +3,8 @@ mod content_hash; extern crate proc_macro; use quote::quote; -use syn::{parse_macro_input, DeriveInput}; +use syn::parse_macro_input; +use syn::DeriveInput; /// Derives the `ContentHash` trait for a struct by calling `ContentHash::hash` /// on each of the struct members in the order that they're declared. All diff --git a/lib/src/backend.rs b/lib/src/backend.rs index 7481713f58..b3ce006d51 100644 --- a/lib/src/backend.rs +++ b/lib/src/backend.rs @@ -27,8 +27,12 @@ use thiserror::Error; use crate::content_hash::ContentHash; use crate::index::Index; use crate::merge::Merge; -use crate::object_id::{id_type, ObjectId}; -use crate::repo_path::{RepoPath, RepoPathBuf, RepoPathComponent, RepoPathComponentBuf}; +use crate::object_id::id_type; +use crate::object_id::ObjectId; +use crate::repo_path::RepoPath; +use crate::repo_path::RepoPathBuf; +use crate::repo_path::RepoPathComponent; +use crate::repo_path::RepoPathComponentBuf; use crate::signing::SignResult; id_type!( diff --git a/lib/src/commit.rs b/lib/src/commit.rs index 78d9934437..fa8d3aab65 100644 --- a/lib/src/commit.rs +++ b/lib/src/commit.rs @@ -15,17 +15,26 @@ #![allow(missing_docs)] use std::cmp::Ordering; -use std::fmt::{Debug, Error, Formatter}; -use std::hash::{Hash, Hasher}; +use std::fmt::Debug; +use std::fmt::Error; +use std::fmt::Formatter; +use std::hash::Hash; +use std::hash::Hasher; use std::sync::Arc; use itertools::Itertools; -use crate::backend::{self, BackendResult, ChangeId, CommitId, MergedTreeId, Signature}; +use crate::backend::BackendResult; +use crate::backend::ChangeId; +use crate::backend::CommitId; +use crate::backend::MergedTreeId; +use crate::backend::Signature; +use crate::backend::{self}; use crate::merged_tree::MergedTree; use crate::repo::Repo; use crate::rewrite::merge_commit_trees; -use crate::signing::{SignResult, Verification}; +use crate::signing::SignResult; +use crate::signing::Verification; use crate::store::Store; #[derive(Clone)] diff --git a/lib/src/commit_builder.rs b/lib/src/commit_builder.rs index fd02c4b4e4..88c4249230 100644 --- a/lib/src/commit_builder.rs +++ b/lib/src/commit_builder.rs @@ -16,10 +16,18 @@ use std::sync::Arc; -use crate::backend::{self, BackendResult, ChangeId, CommitId, MergedTreeId, Signature}; +use crate::backend::BackendResult; +use crate::backend::ChangeId; +use crate::backend::CommitId; +use crate::backend::MergedTreeId; +use crate::backend::Signature; +use crate::backend::{self}; use crate::commit::Commit; -use crate::repo::{MutableRepo, Repo}; -use crate::settings::{JJRng, SignSettings, UserSettings}; +use crate::repo::MutableRepo; +use crate::repo::Repo; +use crate::settings::JJRng; +use crate::settings::SignSettings; +use crate::settings::UserSettings; use crate::signing::SignBehavior; use crate::store::Store; diff --git a/lib/src/conflicts.rs b/lib/src/conflicts.rs index 2030f3fddb..f0399dbb95 100644 --- a/lib/src/conflicts.rs +++ b/lib/src/conflicts.rs @@ -14,21 +14,37 @@ #![allow(missing_docs)] -use std::io::{Read, Write}; +use std::io::Read; +use std::io::Write; use std::iter::zip; use futures::stream::BoxStream; -use futures::{try_join, Stream, StreamExt, TryStreamExt}; +use futures::try_join; +use futures::Stream; +use futures::StreamExt; +use futures::TryStreamExt; use itertools::Itertools; -use regex::bytes::{Regex, RegexBuilder}; - -use crate::backend::{BackendError, BackendResult, CommitId, FileId, SymlinkId, TreeId, TreeValue}; +use regex::bytes::Regex; +use regex::bytes::RegexBuilder; + +use crate::backend::BackendError; +use crate::backend::BackendResult; +use crate::backend::CommitId; +use crate::backend::FileId; +use crate::backend::SymlinkId; +use crate::backend::TreeId; +use crate::backend::TreeValue; use crate::copies::CopiesTreeDiffEntry; -use crate::diff::{Diff, DiffHunk}; +use crate::diff::Diff; +use crate::diff::DiffHunk; use crate::files; -use crate::files::{ContentHunk, MergeResult}; -use crate::merge::{Merge, MergeBuilder, MergedTreeValue}; -use crate::repo_path::{RepoPath, RepoPathBuf}; +use crate::files::ContentHunk; +use crate::files::MergeResult; +use crate::merge::Merge; +use crate::merge::MergeBuilder; +use crate::merge::MergedTreeValue; +use crate::repo_path::RepoPath; +use crate::repo_path::RepoPathBuf; use crate::store::Store; const CONFLICT_START_LINE: &[u8] = b"<<<<<<<"; diff --git a/lib/src/content_hash.rs b/lib/src/content_hash.rs index 4738697680..e3918589af 100644 --- a/lib/src/content_hash.rs +++ b/lib/src/content_hash.rs @@ -147,7 +147,8 @@ where #[cfg(test)] mod tests { - use std::collections::{BTreeMap, HashMap}; + use std::collections::BTreeMap; + use std::collections::HashMap; use super::*; diff --git a/lib/src/copies.rs b/lib/src/copies.rs index ce85ad66c5..10ab46b3c8 100644 --- a/lib/src/copies.rs +++ b/lib/src/copies.rs @@ -16,14 +16,19 @@ use std::collections::HashMap; use std::pin::Pin; -use std::task::{ready, Context, Poll}; +use std::task::ready; +use std::task::Context; +use std::task::Poll; use futures::Stream; -use crate::backend::{BackendResult, CopyRecord}; +use crate::backend::BackendResult; +use crate::backend::CopyRecord; use crate::merge::MergedTreeValue; -use crate::merged_tree::{MergedTree, TreeDiffStream}; -use crate::repo_path::{RepoPath, RepoPathBuf}; +use crate::merged_tree::MergedTree; +use crate::merged_tree::TreeDiffStream; +use crate::repo_path::RepoPath; +use crate::repo_path::RepoPathBuf; /// A collection of CopyRecords. #[derive(Default, Debug)] diff --git a/lib/src/dag_walk.rs b/lib/src/dag_walk.rs index 512d6059ad..dd383f9a47 100644 --- a/lib/src/dag_walk.rs +++ b/lib/src/dag_walk.rs @@ -14,10 +14,13 @@ //! General-purpose DAG algorithms. -use std::collections::{BinaryHeap, HashMap, HashSet}; +use std::collections::BinaryHeap; +use std::collections::HashMap; +use std::collections::HashSet; use std::convert::Infallible; use std::hash::Hash; -use std::{iter, mem}; +use std::iter; +use std::mem; use itertools::Itertools as _; @@ -595,7 +598,8 @@ fn to_ok_iter(iter: impl IntoIterator) -> impl Iterator impl FnMut() -> CommitId { diff --git a/lib/src/default_index/mutable.rs b/lib/src/default_index/mutable.rs index efb91b1853..353550dbeb 100644 --- a/lib/src/default_index/mutable.rs +++ b/lib/src/default_index/mutable.rs @@ -16,7 +16,8 @@ use std::any::Any; use std::cmp::max; -use std::collections::{BTreeMap, HashMap}; +use std::collections::BTreeMap; +use std::collections::HashMap; use std::io; use std::io::Write; use std::ops::Bound; @@ -26,22 +27,38 @@ use std::sync::Arc; use blake2::Blake2b512; use digest::Digest; use itertools::Itertools; -use smallvec::{smallvec, SmallVec}; +use smallvec::smallvec; +use smallvec::SmallVec; use tempfile::NamedTempFile; -use super::composite::{ - AsCompositeIndex, ChangeIdIndexImpl, CompositeIndex, DynIndexSegment, IndexSegment, -}; -use super::entry::{IndexPosition, LocalPosition, SmallIndexPositionsVec, SmallLocalPositionsVec}; -use super::readonly::{ - DefaultReadonlyIndex, ReadonlyIndexSegment, INDEX_SEGMENT_FILE_FORMAT_VERSION, OVERFLOW_FLAG, -}; -use crate::backend::{ChangeId, CommitId}; +use super::composite::AsCompositeIndex; +use super::composite::ChangeIdIndexImpl; +use super::composite::CompositeIndex; +use super::composite::DynIndexSegment; +use super::composite::IndexSegment; +use super::entry::IndexPosition; +use super::entry::LocalPosition; +use super::entry::SmallIndexPositionsVec; +use super::entry::SmallLocalPositionsVec; +use super::readonly::DefaultReadonlyIndex; +use super::readonly::ReadonlyIndexSegment; +use super::readonly::INDEX_SEGMENT_FILE_FORMAT_VERSION; +use super::readonly::OVERFLOW_FLAG; +use crate::backend::ChangeId; +use crate::backend::CommitId; use crate::commit::Commit; use crate::file_util::persist_content_addressed_temp_file; -use crate::index::{AllHeadsForGcUnsupported, ChangeIdIndex, Index, MutableIndex, ReadonlyIndex}; -use crate::object_id::{HexPrefix, ObjectId, PrefixResolution}; -use crate::revset::{ResolvedExpression, Revset, RevsetEvaluationError}; +use crate::index::AllHeadsForGcUnsupported; +use crate::index::ChangeIdIndex; +use crate::index::Index; +use crate::index::MutableIndex; +use crate::index::ReadonlyIndex; +use crate::object_id::HexPrefix; +use crate::object_id::ObjectId; +use crate::object_id::PrefixResolution; +use crate::revset::ResolvedExpression; +use crate::revset::Revset; +use crate::revset::RevsetEvaluationError; use crate::store::Store; #[derive(Debug)] diff --git a/lib/src/default_index/readonly.rs b/lib/src/default_index/readonly.rs index e7a43a9377..111680b632 100644 --- a/lib/src/default_index/readonly.rs +++ b/lib/src/default_index/readonly.rs @@ -16,7 +16,8 @@ use std::any::Any; use std::cmp::Ordering; -use std::fmt::{Debug, Formatter}; +use std::fmt::Debug; +use std::fmt::Formatter; use std::fs::File; use std::io; use std::io::Read; @@ -26,13 +27,28 @@ use std::sync::Arc; use smallvec::smallvec; use thiserror::Error; -use super::composite::{AsCompositeIndex, ChangeIdIndexImpl, CompositeIndex, IndexSegment}; -use super::entry::{IndexPosition, LocalPosition, SmallIndexPositionsVec, SmallLocalPositionsVec}; +use super::composite::AsCompositeIndex; +use super::composite::ChangeIdIndexImpl; +use super::composite::CompositeIndex; +use super::composite::IndexSegment; +use super::entry::IndexPosition; +use super::entry::LocalPosition; +use super::entry::SmallIndexPositionsVec; +use super::entry::SmallLocalPositionsVec; use super::mutable::DefaultMutableIndex; -use crate::backend::{ChangeId, CommitId}; -use crate::index::{AllHeadsForGcUnsupported, ChangeIdIndex, Index, MutableIndex, ReadonlyIndex}; -use crate::object_id::{HexPrefix, ObjectId, PrefixResolution}; -use crate::revset::{ResolvedExpression, Revset, RevsetEvaluationError}; +use crate::backend::ChangeId; +use crate::backend::CommitId; +use crate::index::AllHeadsForGcUnsupported; +use crate::index::ChangeIdIndex; +use crate::index::Index; +use crate::index::MutableIndex; +use crate::index::ReadonlyIndex; +use crate::object_id::HexPrefix; +use crate::object_id::ObjectId; +use crate::object_id::PrefixResolution; +use crate::revset::ResolvedExpression; +use crate::revset::Revset; +use crate::revset::RevsetEvaluationError; use crate::store::Store; /// Error while loading index segment file. diff --git a/lib/src/default_index/rev_walk.rs b/lib/src/default_index/rev_walk.rs index 054f351014..43ff667bf1 100644 --- a/lib/src/default_index/rev_walk.rs +++ b/lib/src/default_index/rev_walk.rs @@ -14,15 +14,20 @@ #![allow(missing_docs)] -use std::cmp::{max, Reverse}; -use std::collections::{BinaryHeap, HashMap, HashSet}; -use std::iter::{Fuse, FusedIterator}; +use std::cmp::max; +use std::cmp::Reverse; +use std::collections::BinaryHeap; +use std::collections::HashMap; +use std::collections::HashSet; +use std::iter::Fuse; +use std::iter::FusedIterator; use std::ops::Range; use smallvec::SmallVec; use super::composite::CompositeIndex; -use super::entry::{IndexPosition, SmallIndexPositionsVec}; +use super::entry::IndexPosition; +use super::entry::SmallIndexPositionsVec; /// Like `Iterator`, but doesn't borrow the `index` internally. pub(super) trait RevWalk { @@ -775,7 +780,8 @@ mod tests { use super::super::composite::AsCompositeIndex as _; use super::super::mutable::DefaultMutableIndex; use super::*; - use crate::backend::{ChangeId, CommitId}; + use crate::backend::ChangeId; + use crate::backend::CommitId; /// Generator of unique 16-byte CommitId excluding root id fn commit_id_generator() -> impl FnMut() -> CommitId { diff --git a/lib/src/default_index/revset_engine.rs b/lib/src/default_index/revset_engine.rs index 7be9766ed3..824a132239 100644 --- a/lib/src/default_index/revset_engine.rs +++ b/lib/src/default_index/revset_engine.rs @@ -15,34 +15,53 @@ #![allow(missing_docs)] use std::cell::RefCell; -use std::cmp::{Ordering, Reverse}; -use std::collections::{BTreeSet, BinaryHeap, HashSet}; +use std::cmp::Ordering; +use std::cmp::Reverse; +use std::collections::BTreeSet; +use std::collections::BinaryHeap; +use std::collections::HashSet; +use std::fmt; +use std::iter; use std::ops::Range; use std::rc::Rc; +use std::str; use std::sync::Arc; -use std::{fmt, iter, str}; use futures::StreamExt as _; use itertools::Itertools; use pollster::FutureExt as _; -use super::rev_walk::{EagerRevWalk, PeekableRevWalk, RevWalk, RevWalkBuilder}; +use super::rev_walk::EagerRevWalk; +use super::rev_walk::PeekableRevWalk; +use super::rev_walk::RevWalk; +use super::rev_walk::RevWalkBuilder; use super::revset_graph_iterator::RevsetGraphWalk; -use crate::backend::{BackendError, BackendResult, ChangeId, CommitId, MillisSinceEpoch}; +use crate::backend::BackendError; +use crate::backend::BackendResult; +use crate::backend::ChangeId; +use crate::backend::CommitId; +use crate::backend::MillisSinceEpoch; use crate::commit::Commit; -use crate::conflicts::{materialize_tree_value, MaterializedTreeValue}; -use crate::default_index::{AsCompositeIndex, CompositeIndex, IndexPosition}; +use crate::conflicts::materialize_tree_value; +use crate::conflicts::MaterializedTreeValue; +use crate::default_index::AsCompositeIndex; +use crate::default_index::CompositeIndex; +use crate::default_index::IndexPosition; use crate::graph::GraphEdge; -use crate::matchers::{Matcher, Visit}; +use crate::matchers::Matcher; +use crate::matchers::Visit; use crate::merged_tree::resolve_file_values; use crate::repo_path::RepoPath; -use crate::revset::{ - ResolvedExpression, ResolvedPredicateExpression, Revset, RevsetEvaluationError, - RevsetFilterPredicate, GENERATION_RANGE_FULL, -}; +use crate::revset::ResolvedExpression; +use crate::revset::ResolvedPredicateExpression; +use crate::revset::Revset; +use crate::revset::RevsetEvaluationError; +use crate::revset::RevsetFilterPredicate; +use crate::revset::GENERATION_RANGE_FULL; +use crate::rewrite; use crate::store::Store; use crate::str_util::StringPattern; -use crate::{rewrite, union_find}; +use crate::union_find; type BoxedPredicateFn<'a> = Box bool + 'a>; pub(super) type BoxedRevWalk<'a> = Box + 'a>; diff --git a/lib/src/default_index/revset_graph_iterator.rs b/lib/src/default_index/revset_graph_iterator.rs index 304f0cfc0e..75bac1d89e 100644 --- a/lib/src/default_index/revset_graph_iterator.rs +++ b/lib/src/default_index/revset_graph_iterator.rs @@ -14,15 +14,20 @@ #![allow(missing_docs)] -use std::cmp::{min, Ordering}; -use std::collections::{BTreeMap, BTreeSet, HashSet}; +use std::cmp::min; +use std::cmp::Ordering; +use std::collections::BTreeMap; +use std::collections::BTreeSet; +use std::collections::HashSet; use super::composite::CompositeIndex; -use super::entry::{IndexEntry, IndexPosition}; +use super::entry::IndexEntry; +use super::entry::IndexPosition; use super::rev_walk::RevWalk; use super::revset_engine::BoxedRevWalk; use crate::backend::CommitId; -use crate::graph::{GraphEdge, GraphEdgeType}; +use crate::graph::GraphEdge; +use crate::graph::GraphEdgeType; /// Like `RevsetGraphEdge`, but stores `IndexPosition` instead. /// diff --git a/lib/src/default_index/store.rs b/lib/src/default_index/store.rs index 5606508c6d..681942b259 100644 --- a/lib/src/default_index/store.rs +++ b/lib/src/default_index/store.rs @@ -16,26 +16,39 @@ use std::any::Any; use std::collections::HashSet; +use std::fs; +use std::io; use std::io::Write; -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; use std::sync::Arc; -use std::{fs, io}; use itertools::Itertools; use tempfile::NamedTempFile; use thiserror::Error; use super::mutable::DefaultMutableIndex; -use super::readonly::{DefaultReadonlyIndex, ReadonlyIndexLoadError, ReadonlyIndexSegment}; -use crate::backend::{BackendError, BackendInitError, CommitId}; +use super::readonly::DefaultReadonlyIndex; +use super::readonly::ReadonlyIndexLoadError; +use super::readonly::ReadonlyIndexSegment; +use crate::backend::BackendError; +use crate::backend::BackendInitError; +use crate::backend::CommitId; use crate::commit::CommitByCommitterTimestamp; use crate::dag_walk; -use crate::file_util::{self, persist_content_addressed_temp_file, IoResultExt as _, PathError}; -use crate::index::{ - Index, IndexReadError, IndexStore, IndexWriteError, MutableIndex, ReadonlyIndex, -}; +use crate::file_util::persist_content_addressed_temp_file; +use crate::file_util::IoResultExt as _; +use crate::file_util::PathError; +use crate::file_util::{self}; +use crate::index::Index; +use crate::index::IndexReadError; +use crate::index::IndexStore; +use crate::index::IndexWriteError; +use crate::index::MutableIndex; +use crate::index::ReadonlyIndex; use crate::object_id::ObjectId; -use crate::op_store::{OpStoreError, OperationId}; +use crate::op_store::OpStoreError; +use crate::op_store::OperationId; use crate::operation::Operation; use crate::store::Store; diff --git a/lib/src/default_submodule_store.rs b/lib/src/default_submodule_store.rs index e15000fc22..ff924540d8 100644 --- a/lib/src/default_submodule_store.rs +++ b/lib/src/default_submodule_store.rs @@ -14,7 +14,8 @@ #![allow(missing_docs)] -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; use crate::submodule_store::SubmoduleStore; diff --git a/lib/src/diff.rs b/lib/src/diff.rs index 59ea147e76..bbd364a93a 100644 --- a/lib/src/diff.rs +++ b/lib/src/diff.rs @@ -14,10 +14,14 @@ #![allow(missing_docs)] -use std::cmp::{max, min, Ordering}; -use std::collections::{BTreeMap, HashMap}; +use std::cmp::max; +use std::cmp::min; +use std::cmp::Ordering; +use std::collections::BTreeMap; +use std::collections::HashMap; +use std::iter; use std::ops::Range; -use std::{iter, slice}; +use std::slice; use bstr::BStr; use itertools::Itertools; diff --git a/lib/src/dsl_util.rs b/lib/src/dsl_util.rs index 7b21c87516..183ec4675f 100644 --- a/lib/src/dsl_util.rs +++ b/lib/src/dsl_util.rs @@ -14,8 +14,9 @@ //! Domain-specific language helpers. +use std::array; use std::collections::HashMap; -use std::{array, fmt}; +use std::fmt; use itertools::Itertools as _; use pest::iterators::Pairs; diff --git a/lib/src/extensions_map.rs b/lib/src/extensions_map.rs index 7e9889a7f6..312f112659 100644 --- a/lib/src/extensions_map.rs +++ b/lib/src/extensions_map.rs @@ -14,7 +14,8 @@ #![allow(missing_docs)] -use std::any::{Any, TypeId}; +use std::any::Any; +use std::any::TypeId; use std::collections::HashMap; /// Type-safe map that stores objects of arbitrary types. diff --git a/lib/src/file_util.rs b/lib/src/file_util.rs index c55b80df8b..22287b82a3 100644 --- a/lib/src/file_util.rs +++ b/lib/src/file_util.rs @@ -14,11 +14,16 @@ #![allow(missing_docs)] -use std::fs::{self, File}; -use std::path::{Component, Path, PathBuf}; -use std::{io, iter}; +use std::fs::File; +use std::fs::{self}; +use std::io; +use std::iter; +use std::path::Component; +use std::path::Path; +use std::path::PathBuf; -use tempfile::{NamedTempFile, PersistError}; +use tempfile::NamedTempFile; +use tempfile::PersistError; use thiserror::Error; pub use self::platform::*; diff --git a/lib/src/files.rs b/lib/src/files.rs index cc0cf22890..605de2e7fc 100644 --- a/lib/src/files.rs +++ b/lib/src/files.rs @@ -16,13 +16,18 @@ use std::borrow::Borrow; use std::collections::VecDeque; -use std::fmt::{Debug, Error, Formatter}; -use std::{iter, mem}; +use std::fmt::Debug; +use std::fmt::Error; +use std::fmt::Formatter; +use std::iter; +use std::mem; use bstr::BStr; -use crate::diff::{Diff, DiffHunk}; -use crate::merge::{trivial_merge, Merge}; +use crate::diff::Diff; +use crate::diff::DiffHunk; +use crate::merge::trivial_merge; +use crate::merge::Merge; /// A diff line which may contain small hunks originating from both sides. #[derive(PartialEq, Eq, Clone, Debug)] diff --git a/lib/src/fileset.rs b/lib/src/fileset.rs index 07b5225836..cb32dd1759 100644 --- a/lib/src/fileset.rs +++ b/lib/src/fileset.rs @@ -15,24 +15,38 @@ //! Functional language for selecting a set of paths. use std::collections::HashMap; -use std::{iter, path, slice}; +use std::iter; +use std::path; +use std::slice; use itertools::Itertools as _; use once_cell::sync::Lazy; use thiserror::Error; use crate::dsl_util::collect_similar; -use crate::fileset_parser::{ - self, BinaryOp, ExpressionKind, ExpressionNode, FunctionCallNode, UnaryOp, -}; -pub use crate::fileset_parser::{FilesetParseError, FilesetParseErrorKind, FilesetParseResult}; -use crate::matchers::{ - DifferenceMatcher, EverythingMatcher, FileGlobsMatcher, FilesMatcher, IntersectionMatcher, - Matcher, NothingMatcher, PrefixMatcher, UnionMatcher, -}; -use crate::repo_path::{ - RelativePathParseError, RepoPath, RepoPathBuf, RepoPathUiConverter, UiPathParseError, -}; +use crate::fileset_parser::BinaryOp; +use crate::fileset_parser::ExpressionKind; +use crate::fileset_parser::ExpressionNode; +pub use crate::fileset_parser::FilesetParseError; +pub use crate::fileset_parser::FilesetParseErrorKind; +pub use crate::fileset_parser::FilesetParseResult; +use crate::fileset_parser::FunctionCallNode; +use crate::fileset_parser::UnaryOp; +use crate::fileset_parser::{self}; +use crate::matchers::DifferenceMatcher; +use crate::matchers::EverythingMatcher; +use crate::matchers::FileGlobsMatcher; +use crate::matchers::FilesMatcher; +use crate::matchers::IntersectionMatcher; +use crate::matchers::Matcher; +use crate::matchers::NothingMatcher; +use crate::matchers::PrefixMatcher; +use crate::matchers::UnionMatcher; +use crate::repo_path::RelativePathParseError; +use crate::repo_path::RepoPath; +use crate::repo_path::RepoPathBuf; +use crate::repo_path::RepoPathUiConverter; +use crate::repo_path::UiPathParseError; /// Error occurred during file pattern parsing. #[derive(Debug, Error)] diff --git a/lib/src/fileset_parser.rs b/lib/src/fileset_parser.rs index 4274f7c9fd..670e19338f 100644 --- a/lib/src/fileset_parser.rs +++ b/lib/src/fileset_parser.rs @@ -19,12 +19,16 @@ use std::error; use itertools::Itertools as _; use once_cell::sync::Lazy; use pest::iterators::Pair; -use pest::pratt_parser::{Assoc, Op, PrattParser}; +use pest::pratt_parser::Assoc; +use pest::pratt_parser::Op; +use pest::pratt_parser::PrattParser; use pest::Parser; use pest_derive::Parser; use thiserror::Error; -use crate::dsl_util::{self, InvalidArguments, StringLiteralParser}; +use crate::dsl_util::InvalidArguments; +use crate::dsl_util::StringLiteralParser; +use crate::dsl_util::{self}; #[derive(Parser)] #[grammar = "fileset.pest"] diff --git a/lib/src/fsmonitor.rs b/lib/src/fsmonitor.rs index c4152159d8..eaa88ed47c 100644 --- a/lib/src/fsmonitor.rs +++ b/lib/src/fsmonitor.rs @@ -22,7 +22,8 @@ use std::path::PathBuf; -use config::{Config, ConfigError}; +use config::Config; +use config::ConfigError; use crate::settings::ConfigResultExt; @@ -84,15 +85,20 @@ impl FsmonitorSettings { /// installed on the system. #[cfg(feature = "watchman")] pub mod watchman { - use std::path::{Path, PathBuf}; + use std::path::Path; + use std::path::PathBuf; use itertools::Itertools; use thiserror::Error; - use tracing::{info, instrument}; + use tracing::info; + use tracing::instrument; use watchman_client::expr; - use watchman_client::prelude::{ - Clock as InnerClock, ClockSpec, NameOnly, QueryRequestCommon, QueryResult, TriggerRequest, - }; + use watchman_client::prelude::Clock as InnerClock; + use watchman_client::prelude::ClockSpec; + use watchman_client::prelude::NameOnly; + use watchman_client::prelude::QueryRequestCommon; + use watchman_client::prelude::QueryResult; + use watchman_client::prelude::TriggerRequest; /// Represents an instance in time from the perspective of the filesystem /// monitor. @@ -123,7 +129,8 @@ pub mod watchman { impl From for crate::protos::working_copy::WatchmanClock { fn from(clock: Clock) -> Self { - use crate::protos::working_copy::{watchman_clock, WatchmanClock}; + use crate::protos::working_copy::watchman_clock; + use crate::protos::working_copy::WatchmanClock; let Clock(clock) = clock; let watchman_clock = match clock { InnerClock::Spec(ClockSpec::StringClock(string_clock)) => { diff --git a/lib/src/git.rs b/lib/src/git.rs index f4030a7ca2..c5e2f85b8a 100644 --- a/lib/src/git.rs +++ b/lib/src/git.rs @@ -15,25 +15,34 @@ #![allow(missing_docs)] use std::borrow::Cow; -use std::collections::{BTreeMap, HashMap, HashSet}; +use std::collections::BTreeMap; +use std::collections::HashMap; +use std::collections::HashSet; use std::default::Default; +use std::fmt; use std::io::Read; use std::path::PathBuf; -use std::{fmt, str}; +use std::str; use git2::Oid; use itertools::Itertools; use tempfile::NamedTempFile; use thiserror::Error; -use crate::backend::{BackendError, CommitId}; +use crate::backend::BackendError; +use crate::backend::CommitId; use crate::commit::Commit; use crate::git_backend::GitBackend; use crate::index::Index; use crate::object_id::ObjectId; -use crate::op_store::{RefTarget, RefTargetOptionExt, RemoteRef, RemoteRefState}; -use crate::refs::{self, BranchPushUpdate}; -use crate::repo::{MutableRepo, Repo}; +use crate::op_store::RefTarget; +use crate::op_store::RefTargetOptionExt; +use crate::op_store::RemoteRef; +use crate::op_store::RemoteRefState; +use crate::refs::BranchPushUpdate; +use crate::refs::{self}; +use crate::repo::MutableRepo; +use crate::repo::Repo; use crate::revset::RevsetExpression; use crate::settings::GitSettings; use crate::store::Store; diff --git a/lib/src/git_backend.rs b/lib/src/git_backend.rs index ea047aae8c..94e56543e2 100644 --- a/lib/src/git_backend.rs +++ b/lib/src/git_backend.rs @@ -16,40 +16,75 @@ use std::any::Any; use std::collections::HashSet; -use std::fmt::{Debug, Error, Formatter}; -use std::io::{Cursor, Read}; -use std::path::{Path, PathBuf}; -use std::process::{Command, ExitStatus}; -use std::sync::{Arc, Mutex, MutexGuard}; +use std::fmt::Debug; +use std::fmt::Error; +use std::fmt::Formatter; +use std::fs; +use std::io; +use std::io::Cursor; +use std::io::Read; +use std::path::Path; +use std::path::PathBuf; +use std::process::Command; +use std::process::ExitStatus; +use std::str; +use std::sync::Arc; +use std::sync::Mutex; +use std::sync::MutexGuard; use std::time::SystemTime; -use std::{fs, io, str}; use async_trait::async_trait; use futures::stream::BoxStream; use gix::bstr::BString; -use gix::objs::{CommitRef, CommitRefIter, WriteTo}; +use gix::objs::CommitRef; +use gix::objs::CommitRefIter; +use gix::objs::WriteTo; use itertools::Itertools; use pollster::FutureExt; use prost::Message; use smallvec::SmallVec; use thiserror::Error; -use crate::backend::{ - make_root_commit, Backend, BackendError, BackendInitError, BackendLoadError, BackendResult, - ChangeId, Commit, CommitId, Conflict, ConflictId, ConflictTerm, CopyRecord, FileId, - MergedTreeId, MillisSinceEpoch, SecureSig, Signature, SigningFn, SymlinkId, Timestamp, Tree, - TreeId, TreeValue, -}; -use crate::file_util::{IoResultExt as _, PathError}; +use crate::backend::make_root_commit; +use crate::backend::Backend; +use crate::backend::BackendError; +use crate::backend::BackendInitError; +use crate::backend::BackendLoadError; +use crate::backend::BackendResult; +use crate::backend::ChangeId; +use crate::backend::Commit; +use crate::backend::CommitId; +use crate::backend::Conflict; +use crate::backend::ConflictId; +use crate::backend::ConflictTerm; +use crate::backend::CopyRecord; +use crate::backend::FileId; +use crate::backend::MergedTreeId; +use crate::backend::MillisSinceEpoch; +use crate::backend::SecureSig; +use crate::backend::Signature; +use crate::backend::SigningFn; +use crate::backend::SymlinkId; +use crate::backend::Timestamp; +use crate::backend::Tree; +use crate::backend::TreeId; +use crate::backend::TreeValue; +use crate::file_util::IoResultExt as _; +use crate::file_util::PathError; use crate::index::Index; use crate::lock::FileLock; -use crate::merge::{Merge, MergeBuilder}; +use crate::merge::Merge; +use crate::merge::MergeBuilder; use crate::object_id::ObjectId; -use crate::repo_path::{RepoPath, RepoPathBuf, RepoPathComponentBuf}; +use crate::repo_path::RepoPath; +use crate::repo_path::RepoPathBuf; +use crate::repo_path::RepoPathComponentBuf; use crate::settings::UserSettings; -use crate::stacked_table::{ - MutableTable, ReadonlyTable, TableSegment, TableStore, TableStoreError, -}; +use crate::stacked_table::MutableTable; +use crate::stacked_table::ReadonlyTable; +use crate::stacked_table::TableSegment; +use crate::stacked_table::TableStore; +use crate::stacked_table::TableStoreError; const HASH_LENGTH: usize = 20; const CHANGE_ID_LENGTH: usize = 16; diff --git a/lib/src/gitignore.rs b/lib/src/gitignore.rs index ff90ef9bde..2ad30b711e 100644 --- a/lib/src/gitignore.rs +++ b/lib/src/gitignore.rs @@ -14,9 +14,11 @@ #![allow(missing_docs)] +use std::fs; +use std::io; +use std::iter; use std::path::PathBuf; use std::sync::Arc; -use std::{fs, io, iter}; use ignore::gitignore; use thiserror::Error; diff --git a/lib/src/gpg_signing.rs b/lib/src/gpg_signing.rs index a4d86b7425..273dc2eddb 100644 --- a/lib/src/gpg_signing.rs +++ b/lib/src/gpg_signing.rs @@ -16,13 +16,19 @@ use std::ffi::OsString; use std::fmt::Debug; +use std::io; use std::io::Write; -use std::process::{Command, ExitStatus, Stdio}; -use std::{io, str}; +use std::process::Command; +use std::process::ExitStatus; +use std::process::Stdio; +use std::str; use thiserror::Error; -use crate::signing::{SigStatus, SignError, SigningBackend, Verification}; +use crate::signing::SigStatus; +use crate::signing::SignError; +use crate::signing::SigningBackend; +use crate::signing::Verification; // Search for one of the: // [GNUPG:] GOODSIG diff --git a/lib/src/graph.rs b/lib/src/graph.rs index 4f9ef678a6..cc9fa582ce 100644 --- a/lib/src/graph.rs +++ b/lib/src/graph.rs @@ -14,7 +14,9 @@ #![allow(missing_docs)] -use std::collections::{HashMap, HashSet, VecDeque}; +use std::collections::HashMap; +use std::collections::HashSet; +use std::collections::VecDeque; use std::hash::Hash; #[derive(Debug, PartialEq, Eq, Clone, Hash)] @@ -303,7 +305,9 @@ where #[cfg(test)] mod tests { use itertools::Itertools as _; - use renderdag::{Ancestor, GraphRowRenderer, Renderer as _}; + use renderdag::Ancestor; + use renderdag::GraphRowRenderer; + use renderdag::Renderer as _; use super::*; diff --git a/lib/src/id_prefix.rs b/lib/src/id_prefix.rs index 5f8fd2ea36..c55607a019 100644 --- a/lib/src/id_prefix.rs +++ b/lib/src/id_prefix.rs @@ -22,13 +22,17 @@ use std::sync::Arc; use itertools::Itertools as _; use once_cell::unsync::OnceCell; -use crate::backend::{ChangeId, CommitId}; +use crate::backend::ChangeId; +use crate::backend::CommitId; use crate::hex_util; -use crate::object_id::{HexPrefix, ObjectId, PrefixResolution}; +use crate::object_id::HexPrefix; +use crate::object_id::ObjectId; +use crate::object_id::PrefixResolution; use crate::repo::Repo; -use crate::revset::{ - DefaultSymbolResolver, RevsetExpression, RevsetExtensions, SymbolResolverExtension, -}; +use crate::revset::DefaultSymbolResolver; +use crate::revset::RevsetExpression; +use crate::revset::RevsetExtensions; +use crate::revset::SymbolResolverExtension; struct PrefixDisambiguationError; diff --git a/lib/src/index.rs b/lib/src/index.rs index 0e74d7ec87..b1263f5bbb 100644 --- a/lib/src/index.rs +++ b/lib/src/index.rs @@ -20,11 +20,15 @@ use std::sync::Arc; use thiserror::Error; -use crate::backend::{ChangeId, CommitId}; +use crate::backend::ChangeId; +use crate::backend::CommitId; use crate::commit::Commit; -use crate::object_id::{HexPrefix, PrefixResolution}; +use crate::object_id::HexPrefix; +use crate::object_id::PrefixResolution; use crate::operation::Operation; -use crate::revset::{ResolvedExpression, Revset, RevsetEvaluationError}; +use crate::revset::ResolvedExpression; +use crate::revset::Revset; +use crate::revset::RevsetEvaluationError; use crate::store::Store; /// Returned if an error occurs while reading an index from the [`IndexStore`]. diff --git a/lib/src/local_backend.rs b/lib/src/local_backend.rs index db12f2795f..05164e46ec 100644 --- a/lib/src/local_backend.rs +++ b/lib/src/local_backend.rs @@ -18,27 +18,49 @@ use std::any::Any; use std::fmt::Debug; use std::fs; use std::fs::File; -use std::io::{Read, Write}; -use std::path::{Path, PathBuf}; +use std::io::Read; +use std::io::Write; +use std::path::Path; +use std::path::PathBuf; use std::time::SystemTime; use async_trait::async_trait; -use blake2::{Blake2b512, Digest}; +use blake2::Blake2b512; +use blake2::Digest; use futures::stream::BoxStream; use prost::Message; use tempfile::NamedTempFile; -use crate::backend::{ - make_root_commit, Backend, BackendError, BackendResult, ChangeId, Commit, CommitId, Conflict, - ConflictId, ConflictTerm, CopyRecord, FileId, MergedTreeId, MillisSinceEpoch, SecureSig, - Signature, SigningFn, SymlinkId, Timestamp, Tree, TreeId, TreeValue, -}; +use crate::backend::make_root_commit; +use crate::backend::Backend; +use crate::backend::BackendError; +use crate::backend::BackendResult; +use crate::backend::ChangeId; +use crate::backend::Commit; +use crate::backend::CommitId; +use crate::backend::Conflict; +use crate::backend::ConflictId; +use crate::backend::ConflictTerm; +use crate::backend::CopyRecord; +use crate::backend::FileId; +use crate::backend::MergedTreeId; +use crate::backend::MillisSinceEpoch; +use crate::backend::SecureSig; +use crate::backend::Signature; +use crate::backend::SigningFn; +use crate::backend::SymlinkId; +use crate::backend::Timestamp; +use crate::backend::Tree; +use crate::backend::TreeId; +use crate::backend::TreeValue; use crate::content_hash::blake2b_hash; use crate::file_util::persist_content_addressed_temp_file; use crate::index::Index; use crate::merge::MergeBuilder; use crate::object_id::ObjectId; -use crate::repo_path::{RepoPath, RepoPathBuf, RepoPathComponentBuf}; +use crate::repo_path::RepoPath; +use crate::repo_path::RepoPathBuf; +use crate::repo_path::RepoPathComponentBuf; const COMMIT_ID_LENGTH: usize = 64; const CHANGE_ID_LENGTH: usize = 16; diff --git a/lib/src/local_working_copy.rs b/lib/src/local_working_copy.rs index a097955a4d..930eb0f3e3 100644 --- a/lib/src/local_working_copy.rs +++ b/lib/src/local_working_copy.rs @@ -18,19 +18,28 @@ use std::any::Any; use std::collections::HashSet; use std::error::Error; -use std::fs::{File, Metadata, OpenOptions}; -use std::io::{Read, Write}; +use std::fs; +use std::fs::File; +use std::fs::Metadata; +use std::fs::OpenOptions; +use std::io::Read; +use std::io::Write; +use std::iter; +use std::mem; use std::ops::Range; #[cfg(unix)] use std::os::unix::fs::PermissionsExt; -use std::path::{Path, PathBuf}; -use std::sync::mpsc::{channel, Sender}; +use std::path::Path; +use std::path::PathBuf; +use std::slice; +use std::sync::mpsc::channel; +use std::sync::mpsc::Sender; use std::sync::Arc; use std::time::UNIX_EPOCH; -use std::{fs, iter, mem, slice}; use futures::StreamExt; -use itertools::{EitherOrBoth, Itertools}; +use itertools::EitherOrBoth; +use itertools::Itertools; use once_cell::unsync::OnceCell; use pollster::FutureExt; use prost::Message; @@ -38,35 +47,61 @@ use rayon::iter::IntoParallelIterator; use rayon::prelude::ParallelIterator; use tempfile::NamedTempFile; use thiserror::Error; -use tracing::{instrument, trace_span}; - -use crate::backend::{ - BackendError, BackendResult, FileId, MergedTreeId, MillisSinceEpoch, SymlinkId, TreeId, - TreeValue, -}; +use tracing::instrument; +use tracing::trace_span; + +use crate::backend::BackendError; +use crate::backend::BackendResult; +use crate::backend::FileId; +use crate::backend::MergedTreeId; +use crate::backend::MillisSinceEpoch; +use crate::backend::SymlinkId; +use crate::backend::TreeId; +use crate::backend::TreeValue; use crate::commit::Commit; -use crate::conflicts::{self, materialize_tree_value, MaterializedTreeValue}; -use crate::file_util::{check_symlink_support, try_symlink}; +use crate::conflicts::materialize_tree_value; +use crate::conflicts::MaterializedTreeValue; +use crate::conflicts::{self}; +use crate::file_util::check_symlink_support; +use crate::file_util::try_symlink; +#[cfg(feature = "watchman")] +use crate::fsmonitor::watchman; use crate::fsmonitor::FsmonitorSettings; #[cfg(feature = "watchman")] -use crate::fsmonitor::{watchman, WatchmanConfig}; +use crate::fsmonitor::WatchmanConfig; use crate::gitignore::GitIgnoreFile; use crate::lock::FileLock; -use crate::matchers::{ - DifferenceMatcher, EverythingMatcher, FilesMatcher, IntersectionMatcher, Matcher, PrefixMatcher, -}; -use crate::merge::{Merge, MergeBuilder, MergedTreeValue}; -use crate::merged_tree::{MergedTree, MergedTreeBuilder, TreeDiffEntry}; +use crate::matchers::DifferenceMatcher; +use crate::matchers::EverythingMatcher; +use crate::matchers::FilesMatcher; +use crate::matchers::IntersectionMatcher; +use crate::matchers::Matcher; +use crate::matchers::PrefixMatcher; +use crate::merge::Merge; +use crate::merge::MergeBuilder; +use crate::merge::MergedTreeValue; +use crate::merged_tree::MergedTree; +use crate::merged_tree::MergedTreeBuilder; +use crate::merged_tree::TreeDiffEntry; use crate::object_id::ObjectId; -use crate::op_store::{OperationId, WorkspaceId}; -use crate::repo_path::{RepoPath, RepoPathBuf, RepoPathComponent}; +use crate::op_store::OperationId; +use crate::op_store::WorkspaceId; +use crate::repo_path::RepoPath; +use crate::repo_path::RepoPathBuf; +use crate::repo_path::RepoPathComponent; use crate::settings::HumanByteSize; use crate::store::Store; use crate::tree::Tree; -use crate::working_copy::{ - CheckoutError, CheckoutStats, LockedWorkingCopy, ResetError, SnapshotError, SnapshotOptions, - SnapshotProgress, WorkingCopy, WorkingCopyFactory, WorkingCopyStateError, -}; +use crate::working_copy::CheckoutError; +use crate::working_copy::CheckoutStats; +use crate::working_copy::LockedWorkingCopy; +use crate::working_copy::ResetError; +use crate::working_copy::SnapshotError; +use crate::working_copy::SnapshotOptions; +use crate::working_copy::SnapshotProgress; +use crate::working_copy::WorkingCopy; +use crate::working_copy::WorkingCopyFactory; +use crate::working_copy::WorkingCopyStateError; #[cfg(unix)] type FileExecutableFlag = bool; diff --git a/lib/src/lock.rs b/lib/src/lock.rs index bf7b0e9d27..7bcb237ce1 100644 --- a/lib/src/lock.rs +++ b/lib/src/lock.rs @@ -23,8 +23,9 @@ pub use platform::FileLock; #[cfg(test)] mod tests { use std::cmp::max; + use std::fs; + use std::thread; use std::time::Duration; - use std::{fs, thread}; use super::*; diff --git a/lib/src/lock/fallback.rs b/lib/src/lock/fallback.rs index 154549c619..29eb0bf565 100644 --- a/lib/src/lock/fallback.rs +++ b/lib/src/lock/fallback.rs @@ -12,11 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::fs::{File, OpenOptions}; +use std::fs::File; +use std::fs::OpenOptions; use std::path::PathBuf; use std::time::Duration; -use backoff::{retry, ExponentialBackoff}; +use backoff::retry; +use backoff::ExponentialBackoff; use tracing::instrument; pub struct FileLock { diff --git a/lib/src/matchers.rs b/lib/src/matchers.rs index bd81b4e858..412157733c 100644 --- a/lib/src/matchers.rs +++ b/lib/src/matchers.rs @@ -14,14 +14,17 @@ #![allow(missing_docs)] -use std::collections::{HashMap, HashSet}; +use std::collections::HashMap; +use std::collections::HashSet; +use std::fmt; use std::fmt::Debug; -use std::{fmt, iter}; +use std::iter; use itertools::Itertools as _; use tracing::instrument; -use crate::repo_path::{RepoPath, RepoPathComponentBuf}; +use crate::repo_path::RepoPath; +use crate::repo_path::RepoPathComponentBuf; #[derive(PartialEq, Eq, Debug)] pub enum Visit { diff --git a/lib/src/merge.rs b/lib/src/merge.rs index 04bba6ec0a..4542004220 100644 --- a/lib/src/merge.rs +++ b/lib/src/merge.rs @@ -17,7 +17,8 @@ use std::borrow::Borrow; use std::collections::HashMap; -use std::fmt::{Debug, Formatter}; +use std::fmt::Debug; +use std::fmt::Formatter; use std::hash::Hash; use std::io::Write; use std::iter::zip; @@ -25,10 +26,16 @@ use std::slice; use std::sync::Arc; use itertools::Itertools; -use smallvec::{smallvec_inline, SmallVec}; - -use crate::backend::{self, BackendResult, FileId, TreeId, TreeValue}; -use crate::content_hash::{ContentHash, DigestUpdate}; +use smallvec::smallvec_inline; +use smallvec::SmallVec; + +use crate::backend::BackendResult; +use crate::backend::FileId; +use crate::backend::TreeId; +use crate::backend::TreeValue; +use crate::backend::{self}; +use crate::content_hash::ContentHash; +use crate::content_hash::DigestUpdate; use crate::object_id::ObjectId; use crate::repo_path::RepoPath; use crate::store::Store; diff --git a/lib/src/merged_tree.rs b/lib/src/merged_tree.rs index efbf6f8280..bdc730ebdb 100644 --- a/lib/src/merged_tree.rs +++ b/lib/src/merged_tree.rs @@ -15,28 +15,47 @@ //! A lazily merged view of a set of trees. use std::borrow::Borrow; -use std::cmp::{max, Ordering}; -use std::collections::{BTreeMap, VecDeque}; +use std::cmp::max; +use std::cmp::Ordering; +use std::collections::BTreeMap; +use std::collections::VecDeque; +use std::iter; use std::iter::zip; use std::pin::Pin; use std::sync::Arc; -use std::task::{Context, Poll}; -use std::{iter, vec}; +use std::task::Context; +use std::task::Poll; +use std::vec; use either::Either; use futures::future::BoxFuture; -use futures::stream::{BoxStream, StreamExt}; -use futures::{Stream, TryStreamExt}; -use itertools::{EitherOrBoth, Itertools}; +use futures::stream::BoxStream; +use futures::stream::StreamExt; +use futures::Stream; +use futures::TryStreamExt; +use itertools::EitherOrBoth; +use itertools::Itertools; use crate::backend; -use crate::backend::{BackendResult, MergedTreeId, TreeId, TreeValue}; -use crate::copies::{CopiesTreeDiffEntry, CopiesTreeDiffStream, CopyRecords}; -use crate::matchers::{EverythingMatcher, Matcher}; -use crate::merge::{Merge, MergeBuilder, MergedTreeVal, MergedTreeValue}; -use crate::repo_path::{RepoPath, RepoPathBuf, RepoPathComponent}; +use crate::backend::BackendResult; +use crate::backend::MergedTreeId; +use crate::backend::TreeId; +use crate::backend::TreeValue; +use crate::copies::CopiesTreeDiffEntry; +use crate::copies::CopiesTreeDiffStream; +use crate::copies::CopyRecords; +use crate::matchers::EverythingMatcher; +use crate::matchers::Matcher; +use crate::merge::Merge; +use crate::merge::MergeBuilder; +use crate::merge::MergedTreeVal; +use crate::merge::MergedTreeValue; +use crate::repo_path::RepoPath; +use crate::repo_path::RepoPathBuf; +use crate::repo_path::RepoPathComponent; use crate::store::Store; -use crate::tree::{try_resolve_file_conflict, Tree}; +use crate::tree::try_resolve_file_conflict; +use crate::tree::Tree; use crate::tree_builder::TreeBuilder; /// Presents a view of a merged set of trees. diff --git a/lib/src/object_id.rs b/lib/src/object_id.rs index 7b21d4b4aa..061b68bf10 100644 --- a/lib/src/object_id.rs +++ b/lib/src/object_id.rs @@ -101,7 +101,8 @@ macro_rules! impl_id_type { }; } -pub(crate) use {id_type, impl_id_type}; +pub(crate) use id_type; +pub(crate) use impl_id_type; /// An identifier prefix (typically from a type implementing the [`ObjectId`] /// trait) with facilities for converting between bytes and a hex string. diff --git a/lib/src/op_heads_store.rs b/lib/src/op_heads_store.rs index 93f8ba4780..5356e47c44 100644 --- a/lib/src/op_heads_store.rs +++ b/lib/src/op_heads_store.rs @@ -23,7 +23,9 @@ use itertools::Itertools; use thiserror::Error; use crate::dag_walk; -use crate::op_store::{OpStore, OpStoreError, OperationId}; +use crate::op_store::OpStore; +use crate::op_store::OpStoreError; +use crate::op_store::OperationId; use crate::operation::Operation; #[derive(Debug, Error)] diff --git a/lib/src/op_store.rs b/lib/src/op_store.rs index 1eb072c80a..c022ba998d 100644 --- a/lib/src/op_store.rs +++ b/lib/src/op_store.rs @@ -15,8 +15,12 @@ #![allow(missing_docs)] use std::any::Any; -use std::collections::{BTreeMap, HashMap, HashSet}; -use std::fmt::{Debug, Error, Formatter}; +use std::collections::BTreeMap; +use std::collections::HashMap; +use std::collections::HashSet; +use std::fmt::Debug; +use std::fmt::Error; +use std::fmt::Formatter; use std::iter; use std::time::SystemTime; @@ -24,10 +28,15 @@ use itertools::Itertools as _; use once_cell::sync::Lazy; use thiserror::Error; -use crate::backend::{CommitId, MillisSinceEpoch, Timestamp}; +use crate::backend::CommitId; +use crate::backend::MillisSinceEpoch; +use crate::backend::Timestamp; use crate::content_hash::ContentHash; use crate::merge::Merge; -use crate::object_id::{id_type, HexPrefix, ObjectId, PrefixResolution}; +use crate::object_id::id_type; +use crate::object_id::HexPrefix; +use crate::object_id::ObjectId; +use crate::object_id::PrefixResolution; #[derive(ContentHash, PartialEq, Eq, PartialOrd, Ord, Clone, Hash)] pub struct WorkspaceId(String); diff --git a/lib/src/op_walk.rs b/lib/src/op_walk.rs index baeb57ccd6..64bd385a5a 100644 --- a/lib/src/op_walk.rs +++ b/lib/src/op_walk.rs @@ -15,19 +15,28 @@ //! Utility for operation id resolution and traversal. use std::cmp::Ordering; -use std::collections::{HashMap, HashSet}; +use std::collections::HashMap; +use std::collections::HashSet; use std::slice; use std::sync::Arc; use itertools::Itertools as _; use thiserror::Error; -use crate::object_id::{HexPrefix, PrefixResolution}; -use crate::op_heads_store::{OpHeadResolutionError, OpHeadsStore}; -use crate::op_store::{OpStore, OpStoreError, OpStoreResult, OperationId}; +use crate::dag_walk; +use crate::object_id::HexPrefix; +use crate::object_id::PrefixResolution; +use crate::op_heads_store; +use crate::op_heads_store::OpHeadResolutionError; +use crate::op_heads_store::OpHeadsStore; +use crate::op_store::OpStore; +use crate::op_store::OpStoreError; +use crate::op_store::OpStoreResult; +use crate::op_store::OperationId; use crate::operation::Operation; -use crate::repo::{ReadonlyRepo, Repo as _, RepoLoader}; -use crate::{dag_walk, op_heads_store}; +use crate::repo::ReadonlyRepo; +use crate::repo::Repo as _; +use crate::repo::RepoLoader; /// Error that may occur during evaluation of operation set expression. #[derive(Debug, Error)] diff --git a/lib/src/operation.rs b/lib/src/operation.rs index 3a007485bb..9ab588dcb6 100644 --- a/lib/src/operation.rs +++ b/lib/src/operation.rs @@ -15,12 +15,19 @@ #![allow(missing_docs)] use std::cmp::Ordering; -use std::fmt::{Debug, Error, Formatter}; -use std::hash::{Hash, Hasher}; +use std::fmt::Debug; +use std::fmt::Error; +use std::fmt::Formatter; +use std::hash::Hash; +use std::hash::Hasher; use std::sync::Arc; use crate::op_store; -use crate::op_store::{OpStore, OpStoreResult, OperationId, OperationMetadata, ViewId}; +use crate::op_store::OpStore; +use crate::op_store::OpStoreResult; +use crate::op_store::OperationId; +use crate::op_store::OperationMetadata; +use crate::op_store::ViewId; use crate::view::View; /// A wrapper around [`op_store::Operation`] that defines additional methods and diff --git a/lib/src/refs.rs b/lib/src/refs.rs index 64d39be515..b14e273bf4 100644 --- a/lib/src/refs.rs +++ b/lib/src/refs.rs @@ -18,8 +18,10 @@ use itertools::EitherOrBoth; use crate::backend::CommitId; use crate::index::Index; -use crate::merge::{trivial_merge, Merge}; -use crate::op_store::{RefTarget, RemoteRef}; +use crate::merge::trivial_merge; +use crate::merge::Merge; +use crate::op_store::RefTarget; +use crate::op_store::RemoteRef; /// Compares `refs1` and `refs2` targets, yields entry if they differ. /// diff --git a/lib/src/repo.rs b/lib/src/repo.rs index be3112a405..b59618faf9 100644 --- a/lib/src/repo.rs +++ b/lib/src/repo.rs @@ -15,11 +15,15 @@ #![allow(missing_docs)] use std::collections::hash_map::Entry; -use std::collections::{HashMap, HashSet}; -use std::fmt::{Debug, Formatter}; -use std::path::{Path, PathBuf}; +use std::collections::HashMap; +use std::collections::HashSet; +use std::fmt::Debug; +use std::fmt::Formatter; +use std::fs; +use std::path::Path; +use std::path::PathBuf; +use std::slice; use std::sync::Arc; -use std::{fs, slice}; use itertools::Itertools; use once_cell::sync::OnceCell; @@ -27,37 +31,68 @@ use thiserror::Error; use tracing::instrument; use self::dirty_cell::DirtyCell; -use crate::backend::{ - Backend, BackendError, BackendInitError, BackendLoadError, BackendResult, ChangeId, CommitId, - MergedTreeId, -}; -use crate::commit::{Commit, CommitByCommitterTimestamp}; -use crate::commit_builder::{CommitBuilder, DetachedCommitBuilder}; -use crate::default_index::{DefaultIndexStore, DefaultMutableIndex}; +use crate::backend::Backend; +use crate::backend::BackendError; +use crate::backend::BackendInitError; +use crate::backend::BackendLoadError; +use crate::backend::BackendResult; +use crate::backend::ChangeId; +use crate::backend::CommitId; +use crate::backend::MergedTreeId; +use crate::commit::Commit; +use crate::commit::CommitByCommitterTimestamp; +use crate::commit_builder::CommitBuilder; +use crate::commit_builder::DetachedCommitBuilder; +use crate::dag_walk; +use crate::default_index::DefaultIndexStore; +use crate::default_index::DefaultMutableIndex; use crate::default_submodule_store::DefaultSubmoduleStore; -use crate::file_util::{IoResultExt as _, PathError}; -use crate::index::{ChangeIdIndex, Index, IndexReadError, IndexStore, MutableIndex, ReadonlyIndex}; +use crate::file_util::IoResultExt as _; +use crate::file_util::PathError; +use crate::index::ChangeIdIndex; +use crate::index::Index; +use crate::index::IndexReadError; +use crate::index::IndexStore; +use crate::index::MutableIndex; +use crate::index::ReadonlyIndex; use crate::local_backend::LocalBackend; -use crate::object_id::{HexPrefix, ObjectId, PrefixResolution}; -use crate::op_heads_store::{self, OpHeadResolutionError, OpHeadsStore}; -use crate::op_store::{ - OpStore, OpStoreError, OperationId, RefTarget, RemoteRef, RemoteRefState, WorkspaceId, -}; +use crate::object_id::HexPrefix; +use crate::object_id::ObjectId; +use crate::object_id::PrefixResolution; +use crate::op_heads_store::OpHeadResolutionError; +use crate::op_heads_store::OpHeadsStore; +use crate::op_heads_store::{self}; +use crate::op_store; +use crate::op_store::OpStore; +use crate::op_store::OpStoreError; +use crate::op_store::OperationId; +use crate::op_store::RefTarget; +use crate::op_store::RemoteRef; +use crate::op_store::RemoteRefState; +use crate::op_store::WorkspaceId; use crate::operation::Operation; -use crate::refs::{ - diff_named_ref_targets, diff_named_remote_refs, merge_ref_targets, merge_remote_refs, -}; -use crate::revset::{RevsetEvaluationError, RevsetExpression, RevsetIteratorExt}; -use crate::rewrite::{merge_commit_trees, CommitRewriter, DescendantRebaser, RebaseOptions}; -use crate::settings::{RepoSettings, UserSettings}; -use crate::signing::{SignInitError, Signer}; +use crate::refs::diff_named_ref_targets; +use crate::refs::diff_named_remote_refs; +use crate::refs::merge_ref_targets; +use crate::refs::merge_remote_refs; +use crate::revset; +use crate::revset::RevsetEvaluationError; +use crate::revset::RevsetExpression; +use crate::revset::RevsetIteratorExt; +use crate::rewrite::merge_commit_trees; +use crate::rewrite::CommitRewriter; +use crate::rewrite::DescendantRebaser; +use crate::rewrite::RebaseOptions; +use crate::settings::RepoSettings; +use crate::settings::UserSettings; +use crate::signing::SignInitError; +use crate::signing::Signer; use crate::simple_op_heads_store::SimpleOpHeadsStore; use crate::simple_op_store::SimpleOpStore; use crate::store::Store; use crate::submodule_store::SubmoduleStore; use crate::transaction::Transaction; use crate::view::View; -use crate::{dag_walk, op_store, revset}; pub trait Repo { fn store(&self) -> &Arc; @@ -1812,7 +1847,8 @@ pub enum CheckOutCommitError { } mod dirty_cell { - use std::cell::{OnceCell, RefCell}; + use std::cell::OnceCell; + use std::cell::RefCell; /// Cell that lazily updates the value after `mark_dirty()`. /// diff --git a/lib/src/repo_path.rs b/lib/src/repo_path.rs index d2748260bb..06ea7200be 100644 --- a/lib/src/repo_path.rs +++ b/lib/src/repo_path.rs @@ -16,13 +16,18 @@ use std::borrow::Borrow; use std::cmp::Ordering; -use std::fmt::{self, Debug, Formatter}; +use std::fmt::Debug; +use std::fmt::Formatter; +use std::fmt::{self}; use std::iter::FusedIterator; use std::ops::Deref; -use std::path::{Component, Path, PathBuf}; +use std::path::Component; +use std::path::Path; +use std::path::PathBuf; use itertools::Itertools; -use ref_cast::{ref_cast_custom, RefCastCustom}; +use ref_cast::ref_cast_custom; +use ref_cast::RefCastCustom; use thiserror::Error; use crate::content_hash::ContentHash; diff --git a/lib/src/revset.rs b/lib/src/revset.rs index 2ab7a045e3..9bf857aee0 100644 --- a/lib/src/revset.rs +++ b/lib/src/revset.rs @@ -15,7 +15,8 @@ #![allow(missing_docs)] use std::any::Any; -use std::collections::{hash_map, HashMap}; +use std::collections::hash_map; +use std::collections::HashMap; use std::convert::Infallible; use std::fmt; use std::ops::Range; @@ -26,25 +27,39 @@ use itertools::Itertools; use once_cell::sync::Lazy; use thiserror::Error; -use crate::backend::{BackendError, BackendResult, ChangeId, CommitId}; +use crate::backend::BackendError; +use crate::backend::BackendResult; +use crate::backend::ChangeId; +use crate::backend::CommitId; use crate::commit::Commit; -use crate::dsl_util::{collect_similar, AliasExpandError as _}; +use crate::dsl_util; +use crate::dsl_util::collect_similar; +use crate::dsl_util::AliasExpandError as _; +use crate::fileset; use crate::fileset::FilesetExpression; use crate::graph::GraphEdge; use crate::hex_util::to_forward_hex; use crate::id_prefix::IdPrefixContext; -use crate::object_id::{HexPrefix, PrefixResolution}; -use crate::op_store::{RemoteRefState, WorkspaceId}; +use crate::object_id::HexPrefix; +use crate::object_id::PrefixResolution; +use crate::op_store::RemoteRefState; +use crate::op_store::WorkspaceId; use crate::repo::Repo; use crate::repo_path::RepoPathUiConverter; -pub use crate::revset_parser::{ - expect_literal, BinaryOp, ExpressionKind, ExpressionNode, FunctionCallNode, RevsetAliasesMap, - RevsetParseError, RevsetParseErrorKind, UnaryOp, -}; +use crate::revset_parser; +pub use crate::revset_parser::expect_literal; +pub use crate::revset_parser::BinaryOp; +pub use crate::revset_parser::ExpressionKind; +pub use crate::revset_parser::ExpressionNode; +pub use crate::revset_parser::FunctionCallNode; +pub use crate::revset_parser::RevsetAliasesMap; +pub use crate::revset_parser::RevsetParseError; +pub use crate::revset_parser::RevsetParseErrorKind; +pub use crate::revset_parser::UnaryOp; use crate::store::Store; use crate::str_util::StringPattern; -use crate::time_util::{DatePattern, DatePatternContext}; -use crate::{dsl_util, fileset, revset_parser}; +use crate::time_util::DatePattern; +use crate::time_util::DatePatternContext; /// Error occurred during symbol resolution. #[derive(Debug, Error)] diff --git a/lib/src/revset_parser.rs b/lib/src/revset_parser.rs index 234aa0eda3..1ea49ead8d 100644 --- a/lib/src/revset_parser.rs +++ b/lib/src/revset_parser.rs @@ -15,22 +15,35 @@ #![allow(missing_docs)] use std::collections::HashSet; +use std::error; +use std::mem; use std::str::FromStr; -use std::{error, mem}; use itertools::Itertools as _; use once_cell::sync::Lazy; -use pest::iterators::{Pair, Pairs}; -use pest::pratt_parser::{Assoc, Op, PrattParser}; +use pest::iterators::Pair; +use pest::iterators::Pairs; +use pest::pratt_parser::Assoc; +use pest::pratt_parser::Op; +use pest::pratt_parser::PrattParser; use pest::Parser; use pest_derive::Parser; use thiserror::Error; -use crate::dsl_util::{ - self, collect_similar, AliasDeclaration, AliasDeclarationParser, AliasDefinitionParser, - AliasExpandError, AliasExpandableExpression, AliasId, AliasesMap, ExpressionFolder, - FoldableExpression, InvalidArguments, KeywordArgument, StringLiteralParser, -}; +use crate::dsl_util::collect_similar; +use crate::dsl_util::AliasDeclaration; +use crate::dsl_util::AliasDeclarationParser; +use crate::dsl_util::AliasDefinitionParser; +use crate::dsl_util::AliasExpandError; +use crate::dsl_util::AliasExpandableExpression; +use crate::dsl_util::AliasId; +use crate::dsl_util::AliasesMap; +use crate::dsl_util::ExpressionFolder; +use crate::dsl_util::FoldableExpression; +use crate::dsl_util::InvalidArguments; +use crate::dsl_util::KeywordArgument; +use crate::dsl_util::StringLiteralParser; +use crate::dsl_util::{self}; #[derive(Parser)] #[grammar = "revset.pest"] diff --git a/lib/src/rewrite.rs b/lib/src/rewrite.rs index b8dddef9d4..94c165ddea 100644 --- a/lib/src/rewrite.rs +++ b/lib/src/rewrite.rs @@ -14,25 +14,37 @@ #![allow(missing_docs)] -use std::collections::{HashMap, HashSet}; +use std::collections::HashMap; +use std::collections::HashSet; use std::sync::Arc; use futures::StreamExt; -use indexmap::{IndexMap, IndexSet}; +use indexmap::IndexMap; +use indexmap::IndexSet; use itertools::Itertools; use pollster::FutureExt; use tracing::instrument; -use crate::backend::{BackendError, BackendResult, CommitId, MergedTreeId}; -use crate::commit::{Commit, CommitIteratorExt}; +use crate::backend::BackendError; +use crate::backend::BackendResult; +use crate::backend::CommitId; +use crate::backend::MergedTreeId; +use crate::commit::Commit; +use crate::commit::CommitIteratorExt; use crate::commit_builder::CommitBuilder; use crate::dag_walk; use crate::index::Index; -use crate::matchers::{Matcher, Visit}; -use crate::merged_tree::{MergedTree, MergedTreeBuilder, TreeDiffEntry}; -use crate::repo::{MutableRepo, Repo}; +use crate::matchers::Matcher; +use crate::matchers::Visit; +use crate::merged_tree::MergedTree; +use crate::merged_tree::MergedTreeBuilder; +use crate::merged_tree::TreeDiffEntry; +use crate::repo::MutableRepo; +use crate::repo::Repo; use crate::repo_path::RepoPath; -use crate::revset::{RevsetEvaluationError, RevsetExpression, RevsetIteratorExt}; +use crate::revset::RevsetEvaluationError; +use crate::revset::RevsetExpression; +use crate::revset::RevsetIteratorExt; use crate::settings::UserSettings; use crate::store::Store; diff --git a/lib/src/secret_backend.rs b/lib/src/secret_backend.rs index 7c457c24b3..13bf958cd2 100644 --- a/lib/src/secret_backend.rs +++ b/lib/src/secret_backend.rs @@ -22,14 +22,26 @@ use std::time::SystemTime; use async_trait::async_trait; use futures::stream::BoxStream; -use crate::backend::{ - Backend, BackendError, BackendLoadError, BackendResult, ChangeId, Commit, CommitId, Conflict, - ConflictId, CopyRecord, FileId, SigningFn, SymlinkId, Tree, TreeId, -}; +use crate::backend::Backend; +use crate::backend::BackendError; +use crate::backend::BackendLoadError; +use crate::backend::BackendResult; +use crate::backend::ChangeId; +use crate::backend::Commit; +use crate::backend::CommitId; +use crate::backend::Conflict; +use crate::backend::ConflictId; +use crate::backend::CopyRecord; +use crate::backend::FileId; +use crate::backend::SigningFn; +use crate::backend::SymlinkId; +use crate::backend::Tree; +use crate::backend::TreeId; use crate::git_backend::GitBackend; use crate::index::Index; use crate::object_id::ObjectId; -use crate::repo_path::{RepoPath, RepoPathBuf}; +use crate::repo_path::RepoPath; +use crate::repo_path::RepoPathBuf; use crate::settings::UserSettings; const SECRET_CONTENTS_HEX: [&str; 2] = [ diff --git a/lib/src/settings.rs b/lib/src/settings.rs index 617b4bac30..7433a93ff7 100644 --- a/lib/src/settings.rs +++ b/lib/src/settings.rs @@ -15,13 +15,17 @@ #![allow(missing_docs)] use std::path::Path; -use std::sync::{Arc, Mutex}; +use std::sync::Arc; +use std::sync::Mutex; use chrono::DateTime; use rand::prelude::*; use rand_chacha::ChaCha20Rng; -use crate::backend::{ChangeId, Commit, Signature, Timestamp}; +use crate::backend::ChangeId; +use crate::backend::Commit; +use crate::backend::Signature; +use crate::backend::Timestamp; use crate::fmt_util::binary_prefix; use crate::fsmonitor::FsmonitorSettings; use crate::signing::SignBehavior; diff --git a/lib/src/simple_op_heads_store.rs b/lib/src/simple_op_heads_store.rs index 848539aeec..e4b05a1c14 100644 --- a/lib/src/simple_op_heads_store.rs +++ b/lib/src/simple_op_heads_store.rs @@ -15,13 +15,16 @@ #![allow(missing_docs)] use std::any::Any; -use std::fmt::{Debug, Formatter}; +use std::fmt::Debug; +use std::fmt::Formatter; use std::fs; -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; use crate::lock::FileLock; use crate::object_id::ObjectId; -use crate::op_heads_store::{OpHeadsStore, OpHeadsStoreLock}; +use crate::op_heads_store::OpHeadsStore; +use crate::op_heads_store::OpHeadsStoreLock; use crate::op_store::OperationId; pub struct SimpleOpHeadsStore { diff --git a/lib/src/simple_op_store.rs b/lib/src/simple_op_store.rs index 7a9765471e..35533fa103 100644 --- a/lib/src/simple_op_store.rs +++ b/lib/src/simple_op_store.rs @@ -15,28 +15,49 @@ #![allow(missing_docs)] use std::any::Any; -use std::collections::{BTreeMap, HashMap, HashSet}; +use std::collections::BTreeMap; +use std::collections::HashMap; +use std::collections::HashSet; use std::fmt::Debug; -use std::io::{ErrorKind, Write}; -use std::path::{Path, PathBuf}; +use std::fs; +use std::io; +use std::io::ErrorKind; +use std::io::Write; +use std::path::Path; +use std::path::PathBuf; use std::time::SystemTime; -use std::{fs, io}; use itertools::Itertools as _; use prost::Message; use tempfile::NamedTempFile; use thiserror::Error; -use crate::backend::{CommitId, MillisSinceEpoch, Timestamp}; +use crate::backend::CommitId; +use crate::backend::MillisSinceEpoch; +use crate::backend::Timestamp; use crate::content_hash::blake2b_hash; -use crate::file_util::{persist_content_addressed_temp_file, IoResultExt as _, PathError}; +use crate::dag_walk; +use crate::file_util::persist_content_addressed_temp_file; +use crate::file_util::IoResultExt as _; +use crate::file_util::PathError; use crate::merge::Merge; -use crate::object_id::{HexPrefix, ObjectId, PrefixResolution}; -use crate::op_store::{ - OpStore, OpStoreError, OpStoreResult, Operation, OperationId, OperationMetadata, RefTarget, - RemoteRef, RemoteRefState, RemoteView, View, ViewId, WorkspaceId, -}; -use crate::{dag_walk, op_store}; +use crate::object_id::HexPrefix; +use crate::object_id::ObjectId; +use crate::object_id::PrefixResolution; +use crate::op_store; +use crate::op_store::OpStore; +use crate::op_store::OpStoreError; +use crate::op_store::OpStoreResult; +use crate::op_store::Operation; +use crate::op_store::OperationId; +use crate::op_store::OperationMetadata; +use crate::op_store::RefTarget; +use crate::op_store::RemoteRef; +use crate::op_store::RemoteRefState; +use crate::op_store::RemoteView; +use crate::op_store::View; +use crate::op_store::ViewId; +use crate::op_store::WorkspaceId; // BLAKE2b-512 hash length in bytes const OPERATION_ID_LENGTH: usize = 64; @@ -693,7 +714,9 @@ fn remote_ref_state_from_proto(proto_value: Option) -> Option Vec { from_tree diff --git a/lib/tests/test_commit_concurrent.rs b/lib/tests/test_commit_concurrent.rs index 800d92ab27..64304107a0 100644 --- a/lib/tests/test_commit_concurrent.rs +++ b/lib/tests/test_commit_concurrent.rs @@ -17,9 +17,13 @@ use std::sync::Arc; use std::thread; use jj_lib::dag_walk; -use jj_lib::repo::{ReadonlyRepo, Repo}; +use jj_lib::repo::ReadonlyRepo; +use jj_lib::repo::Repo; use test_case::test_case; -use testutils::{load_repo_at_head, write_random_commit, TestRepoBackend, TestWorkspace}; +use testutils::load_repo_at_head; +use testutils::write_random_commit; +use testutils::TestRepoBackend; +use testutils::TestWorkspace; fn count_non_merge_operations(repo: &Arc) -> usize { let op_store = repo.op_store(); diff --git a/lib/tests/test_conflicts.rs b/lib/tests/test_conflicts.rs index 8a79373311..22aba8e75f 100644 --- a/lib/tests/test_conflicts.rs +++ b/lib/tests/test_conflicts.rs @@ -14,9 +14,10 @@ use indoc::indoc; use jj_lib::backend::FileId; -use jj_lib::conflicts::{ - extract_as_single_hunk, materialize_merge_result, parse_conflict, update_from_content, -}; +use jj_lib::conflicts::extract_as_single_hunk; +use jj_lib::conflicts::materialize_merge_result; +use jj_lib::conflicts::parse_conflict; +use jj_lib::conflicts::update_from_content; use jj_lib::merge::Merge; use jj_lib::repo::Repo; use jj_lib::repo_path::RepoPath; diff --git a/lib/tests/test_default_revset_graph_iterator.rs b/lib/tests/test_default_revset_graph_iterator.rs index 7c750f12bb..af309b4fc6 100644 --- a/lib/tests/test_default_revset_graph_iterator.rs +++ b/lib/tests/test_default_revset_graph_iterator.rs @@ -15,13 +15,16 @@ use itertools::Itertools; use jj_lib::backend::CommitId; use jj_lib::commit::Commit; -use jj_lib::default_index::revset_engine::{evaluate, RevsetImpl}; +use jj_lib::default_index::revset_engine::evaluate; +use jj_lib::default_index::revset_engine::RevsetImpl; use jj_lib::default_index::DefaultReadonlyIndex; use jj_lib::graph::GraphEdge; -use jj_lib::repo::{ReadonlyRepo, Repo as _}; +use jj_lib::repo::ReadonlyRepo; +use jj_lib::repo::Repo as _; use jj_lib::revset::ResolvedExpression; use test_case::test_case; -use testutils::{CommitGraphBuilder, TestRepo}; +use testutils::CommitGraphBuilder; +use testutils::TestRepo; fn revset_for_commits( repo: &ReadonlyRepo, diff --git a/lib/tests/test_git.rs b/lib/tests/test_git.rs index 35fe45650e..1adfbe8a02 100644 --- a/lib/tests/test_git.rs +++ b/lib/tests/test_git.rs @@ -12,39 +12,63 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::collections::{BTreeMap, HashSet}; -use std::path::{Path, PathBuf}; -use std::sync::{mpsc, Arc, Barrier}; -use std::{fs, iter, thread}; +use std::collections::BTreeMap; +use std::collections::HashSet; +use std::fs; +use std::iter; +use std::path::Path; +use std::path::PathBuf; +use std::sync::mpsc; +use std::sync::Arc; +use std::sync::Barrier; +use std::thread; use assert_matches::assert_matches; use git2::Oid; use itertools::Itertools; -use jj_lib::backend::{BackendError, ChangeId, CommitId, MillisSinceEpoch, Signature, Timestamp}; +use jj_lib::backend::BackendError; +use jj_lib::backend::ChangeId; +use jj_lib::backend::CommitId; +use jj_lib::backend::MillisSinceEpoch; +use jj_lib::backend::Signature; +use jj_lib::backend::Timestamp; use jj_lib::commit::Commit; use jj_lib::commit_builder::CommitBuilder; use jj_lib::git; -use jj_lib::git::{ - FailedRefExportReason, GitBranchPushTargets, GitFetchError, GitImportError, GitPushError, - GitRefUpdate, RefName, SubmoduleConfig, -}; +use jj_lib::git::FailedRefExportReason; +use jj_lib::git::GitBranchPushTargets; +use jj_lib::git::GitFetchError; +use jj_lib::git::GitImportError; +use jj_lib::git::GitPushError; +use jj_lib::git::GitRefUpdate; +use jj_lib::git::RefName; +use jj_lib::git::SubmoduleConfig; use jj_lib::git_backend::GitBackend; use jj_lib::object_id::ObjectId; -use jj_lib::op_store::{BranchTarget, RefTarget, RemoteRef, RemoteRefState}; +use jj_lib::op_store::BranchTarget; +use jj_lib::op_store::RefTarget; +use jj_lib::op_store::RemoteRef; +use jj_lib::op_store::RemoteRefState; use jj_lib::refs::BranchPushUpdate; -use jj_lib::repo::{MutableRepo, ReadonlyRepo, Repo}; +use jj_lib::repo::MutableRepo; +use jj_lib::repo::ReadonlyRepo; +use jj_lib::repo::Repo; use jj_lib::repo_path::RepoPath; -use jj_lib::settings::{GitSettings, UserSettings}; +use jj_lib::settings::GitSettings; +use jj_lib::settings::UserSettings; use jj_lib::signing::Signer; use jj_lib::str_util::StringPattern; use jj_lib::workspace::Workspace; -use maplit::{btreemap, hashset}; +use maplit::btreemap; +use maplit::hashset; use tempfile::TempDir; use test_case::test_case; -use testutils::{ - commit_transactions, create_random_commit, load_repo_at_head, write_random_commit, TestRepo, - TestRepoBackend, -}; +use testutils::commit_transactions; +use testutils::create_random_commit; +use testutils::load_repo_at_head; +use testutils::write_random_commit; +use testutils::TestRepo; +use testutils::TestRepoBackend; fn empty_git_commit<'r>( git_repo: &'r git2::Repository, diff --git a/lib/tests/test_git_backend.rs b/lib/tests/test_git_backend.rs index 07011a9058..cb4135b609 100644 --- a/lib/tests/test_git_backend.rs +++ b/lib/tests/test_git_backend.rs @@ -12,23 +12,32 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::collections::{HashMap, HashSet}; +use std::collections::HashMap; +use std::collections::HashSet; use std::path::Path; use std::process::Command; use std::sync::Arc; -use std::time::{Duration, SystemTime}; +use std::time::Duration; +use std::time::SystemTime; use futures::executor::block_on_stream; -use jj_lib::backend::{CommitId, CopyRecord}; +use jj_lib::backend::CommitId; +use jj_lib::backend::CopyRecord; use jj_lib::commit::Commit; use jj_lib::git_backend::GitBackend; -use jj_lib::repo::{ReadonlyRepo, Repo}; -use jj_lib::repo_path::{RepoPath, RepoPathBuf}; +use jj_lib::repo::ReadonlyRepo; +use jj_lib::repo::Repo; +use jj_lib::repo_path::RepoPath; +use jj_lib::repo_path::RepoPathBuf; use jj_lib::settings::UserSettings; use jj_lib::store::Store; use jj_lib::transaction::Transaction; use maplit::hashset; -use testutils::{create_random_commit, create_tree, CommitGraphBuilder, TestRepo, TestRepoBackend}; +use testutils::create_random_commit; +use testutils::create_tree; +use testutils::CommitGraphBuilder; +use testutils::TestRepo; +use testutils::TestRepoBackend; fn get_git_backend(repo: &Arc) -> &GitBackend { repo.store() diff --git a/lib/tests/test_gpg.rs b/lib/tests/test_gpg.rs index c1f651083c..ddac993bcf 100644 --- a/lib/tests/test_gpg.rs +++ b/lib/tests/test_gpg.rs @@ -3,12 +3,15 @@ use std::fs::Permissions; use std::io::Write; #[cfg(unix)] use std::os::unix::prelude::PermissionsExt; -use std::process::{Command, Stdio}; +use std::process::Command; +use std::process::Stdio; use assert_matches::assert_matches; use insta::assert_debug_snapshot; use jj_lib::gpg_signing::GpgBackend; -use jj_lib::signing::{SigStatus, SignError, SigningBackend}; +use jj_lib::signing::SigStatus; +use jj_lib::signing::SignError; +use jj_lib::signing::SigningBackend; static PRIVATE_KEY: &str = r#"-----BEGIN PGP PRIVATE KEY BLOCK----- diff --git a/lib/tests/test_id_prefix.rs b/lib/tests/test_id_prefix.rs index 204e12f4c9..6a229644fb 100644 --- a/lib/tests/test_id_prefix.rs +++ b/lib/tests/test_id_prefix.rs @@ -13,13 +13,21 @@ // limitations under the License. use itertools::Itertools; -use jj_lib::backend::{ChangeId, CommitId, MillisSinceEpoch, Signature, Timestamp}; +use jj_lib::backend::ChangeId; +use jj_lib::backend::CommitId; +use jj_lib::backend::MillisSinceEpoch; +use jj_lib::backend::Signature; +use jj_lib::backend::Timestamp; use jj_lib::id_prefix::IdPrefixContext; -use jj_lib::object_id::PrefixResolution::{AmbiguousMatch, NoMatch, SingleMatch}; -use jj_lib::object_id::{HexPrefix, ObjectId}; +use jj_lib::object_id::HexPrefix; +use jj_lib::object_id::ObjectId; +use jj_lib::object_id::PrefixResolution::AmbiguousMatch; +use jj_lib::object_id::PrefixResolution::NoMatch; +use jj_lib::object_id::PrefixResolution::SingleMatch; use jj_lib::repo::Repo; use jj_lib::revset::RevsetExpression; -use testutils::{TestRepo, TestRepoBackend}; +use testutils::TestRepo; +use testutils::TestRepoBackend; #[test] fn test_id_prefix() { diff --git a/lib/tests/test_index.rs b/lib/tests/test_index.rs index fdd7d2244d..3843b66ce4 100644 --- a/lib/tests/test_index.rs +++ b/lib/tests/test_index.rs @@ -17,25 +17,36 @@ use std::fs; use std::sync::Arc; use assert_matches::assert_matches; -use jj_lib::backend::{ChangeId, CommitId}; +use jj_lib::backend::ChangeId; +use jj_lib::backend::CommitId; use jj_lib::commit::Commit; use jj_lib::commit_builder::CommitBuilder; -use jj_lib::default_index::{ - AsCompositeIndex as _, CompositeIndex, DefaultIndexStore, DefaultIndexStoreError, - DefaultMutableIndex, DefaultReadonlyIndex, -}; +use jj_lib::default_index::AsCompositeIndex as _; +use jj_lib::default_index::CompositeIndex; +use jj_lib::default_index::DefaultIndexStore; +use jj_lib::default_index::DefaultIndexStoreError; +use jj_lib::default_index::DefaultMutableIndex; +use jj_lib::default_index::DefaultReadonlyIndex; use jj_lib::index::Index as _; -use jj_lib::object_id::{HexPrefix, ObjectId as _, PrefixResolution}; -use jj_lib::op_store::{RefTarget, RemoteRef}; -use jj_lib::repo::{MutableRepo, ReadonlyRepo, Repo}; -use jj_lib::revset::{ResolvedExpression, GENERATION_RANGE_FULL}; +use jj_lib::object_id::HexPrefix; +use jj_lib::object_id::ObjectId as _; +use jj_lib::object_id::PrefixResolution; +use jj_lib::op_store::RefTarget; +use jj_lib::op_store::RemoteRef; +use jj_lib::repo::MutableRepo; +use jj_lib::repo::ReadonlyRepo; +use jj_lib::repo::Repo; +use jj_lib::revset::ResolvedExpression; +use jj_lib::revset::GENERATION_RANGE_FULL; use jj_lib::settings::UserSettings; use maplit::hashset; +use testutils::commit_transactions; +use testutils::create_random_commit; +use testutils::load_repo_at_head; use testutils::test_backend::TestBackend; -use testutils::{ - commit_transactions, create_random_commit, load_repo_at_head, write_random_commit, - CommitGraphBuilder, TestRepo, -}; +use testutils::write_random_commit; +use testutils::CommitGraphBuilder; +use testutils::TestRepo; fn child_commit<'repo>( mut_repo: &'repo mut MutableRepo, diff --git a/lib/tests/test_init.rs b/lib/tests/test_init.rs index 23ca072215..b06f9a7125 100644 --- a/lib/tests/test_init.rs +++ b/lib/tests/test_init.rs @@ -12,7 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; use jj_lib::git_backend::GitBackend; use jj_lib::op_store::WorkspaceId; @@ -20,7 +21,9 @@ use jj_lib::repo::Repo; use jj_lib::settings::UserSettings; use jj_lib::workspace::Workspace; use test_case::test_case; -use testutils::{write_random_commit, TestRepoBackend, TestWorkspace}; +use testutils::write_random_commit; +use testutils::TestRepoBackend; +use testutils::TestWorkspace; fn canonicalize(input: &Path) -> (PathBuf, PathBuf) { let uncanonical = input.join("..").join(input.file_name().unwrap()); diff --git a/lib/tests/test_load_repo.rs b/lib/tests/test_load_repo.rs index 96092a9ba2..9fb2bd4ae6 100644 --- a/lib/tests/test_load_repo.rs +++ b/lib/tests/test_load_repo.rs @@ -13,7 +13,8 @@ // limitations under the License. use jj_lib::repo::RepoLoader; -use testutils::{write_random_commit, TestRepo}; +use testutils::write_random_commit; +use testutils::TestRepo; #[test] fn test_load_at_operation() { diff --git a/lib/tests/test_local_working_copy.rs b/lib/tests/test_local_working_copy.rs index 771d9b0f5e..ed6820c3f8 100644 --- a/lib/tests/test_local_working_copy.rs +++ b/lib/tests/test_local_working_copy.rs @@ -21,23 +21,39 @@ use std::sync::Arc; use indoc::indoc; use itertools::Itertools; -use jj_lib::backend::{MergedTreeId, TreeId, TreeValue}; -use jj_lib::file_util::{check_symlink_support, try_symlink}; +use jj_lib::backend::MergedTreeId; +use jj_lib::backend::TreeId; +use jj_lib::backend::TreeValue; +use jj_lib::file_util::check_symlink_support; +use jj_lib::file_util::try_symlink; use jj_lib::fsmonitor::FsmonitorSettings; use jj_lib::local_working_copy::LocalWorkingCopy; -use jj_lib::merge::{Merge, MergedTreeValue}; -use jj_lib::merged_tree::{MergedTree, MergedTreeBuilder}; -use jj_lib::op_store::{OperationId, WorkspaceId}; -use jj_lib::repo::{ReadonlyRepo, Repo}; -use jj_lib::repo_path::{RepoPath, RepoPathBuf, RepoPathComponent}; +use jj_lib::merge::Merge; +use jj_lib::merge::MergedTreeValue; +use jj_lib::merged_tree::MergedTree; +use jj_lib::merged_tree::MergedTreeBuilder; +use jj_lib::op_store::OperationId; +use jj_lib::op_store::WorkspaceId; +use jj_lib::repo::ReadonlyRepo; +use jj_lib::repo::Repo; +use jj_lib::repo_path::RepoPath; +use jj_lib::repo_path::RepoPathBuf; +use jj_lib::repo_path::RepoPathComponent; use jj_lib::secret_backend::SecretBackend; use jj_lib::settings::UserSettings; -use jj_lib::working_copy::{CheckoutStats, SnapshotError, SnapshotOptions}; -use jj_lib::workspace::{default_working_copy_factories, LockedWorkspace, Workspace}; +use jj_lib::working_copy::CheckoutStats; +use jj_lib::working_copy::SnapshotError; +use jj_lib::working_copy::SnapshotOptions; +use jj_lib::workspace::default_working_copy_factories; +use jj_lib::workspace::LockedWorkspace; +use jj_lib::workspace::Workspace; use test_case::test_case; -use testutils::{ - commit_with_tree, create_tree, write_random_commit, TestRepo, TestRepoBackend, TestWorkspace, -}; +use testutils::commit_with_tree; +use testutils::create_tree; +use testutils::write_random_commit; +use testutils::TestRepo; +use testutils::TestRepoBackend; +use testutils::TestWorkspace; fn to_owned_path_vec(paths: &[&RepoPath]) -> Vec { paths.iter().map(|&path| path.to_owned()).collect() diff --git a/lib/tests/test_local_working_copy_concurrent.rs b/lib/tests/test_local_working_copy_concurrent.rs index 695e3f6e6a..f1bd0c0467 100644 --- a/lib/tests/test_local_working_copy_concurrent.rs +++ b/lib/tests/test_local_working_copy_concurrent.rs @@ -17,10 +17,17 @@ use std::thread; use assert_matches::assert_matches; use jj_lib::repo::Repo; -use jj_lib::repo_path::{RepoPath, RepoPathBuf}; -use jj_lib::working_copy::{CheckoutError, SnapshotOptions}; -use jj_lib::workspace::{default_working_copy_factories, Workspace}; -use testutils::{commit_with_tree, create_tree, write_working_copy_file, TestRepo, TestWorkspace}; +use jj_lib::repo_path::RepoPath; +use jj_lib::repo_path::RepoPathBuf; +use jj_lib::working_copy::CheckoutError; +use jj_lib::working_copy::SnapshotOptions; +use jj_lib::workspace::default_working_copy_factories; +use jj_lib::workspace::Workspace; +use testutils::commit_with_tree; +use testutils::create_tree; +use testutils::write_working_copy_file; +use testutils::TestRepo; +use testutils::TestWorkspace; #[test] fn test_concurrent_checkout() { diff --git a/lib/tests/test_local_working_copy_sparse.rs b/lib/tests/test_local_working_copy_sparse.rs index b2a614557a..ecbc012c34 100644 --- a/lib/tests/test_local_working_copy_sparse.rs +++ b/lib/tests/test_local_working_copy_sparse.rs @@ -17,10 +17,14 @@ use itertools::Itertools; use jj_lib::local_working_copy::LocalWorkingCopy; use jj_lib::matchers::EverythingMatcher; use jj_lib::repo::Repo; -use jj_lib::repo_path::{RepoPath, RepoPathBuf}; -use jj_lib::working_copy::{CheckoutStats, WorkingCopy}; +use jj_lib::repo_path::RepoPath; +use jj_lib::repo_path::RepoPathBuf; +use jj_lib::working_copy::CheckoutStats; +use jj_lib::working_copy::WorkingCopy; use pollster::FutureExt as _; -use testutils::{commit_with_tree, create_tree, TestWorkspace}; +use testutils::commit_with_tree; +use testutils::create_tree; +use testutils::TestWorkspace; fn to_owned_path_vec(paths: &[&RepoPath]) -> Vec { paths.iter().map(|&path| path.to_owned()).collect() diff --git a/lib/tests/test_merge_trees.rs b/lib/tests/test_merge_trees.rs index de4d37971b..9706ca7b79 100644 --- a/lib/tests/test_merge_trees.rs +++ b/lib/tests/test_merge_trees.rs @@ -15,10 +15,14 @@ use itertools::Itertools; use jj_lib::backend::TreeValue; use jj_lib::repo::Repo; -use jj_lib::repo_path::{RepoPath, RepoPathComponent}; +use jj_lib::repo_path::RepoPath; +use jj_lib::repo_path::RepoPathComponent; use jj_lib::rewrite::rebase_commit; -use jj_lib::tree::{merge_trees, Tree}; -use testutils::{create_single_tree, create_tree, TestRepo}; +use jj_lib::tree::merge_trees; +use jj_lib::tree::Tree; +use testutils::create_single_tree; +use testutils::create_tree; +use testutils::TestRepo; #[test] fn test_same_type() { diff --git a/lib/tests/test_merged_tree.rs b/lib/tests/test_merged_tree.rs index 3450c52c46..c3efb2dc64 100644 --- a/lib/tests/test_merged_tree.rs +++ b/lib/tests/test_merged_tree.rs @@ -14,19 +14,34 @@ use futures::StreamExt; use itertools::Itertools; -use jj_lib::backend::{CommitId, CopyRecord, FileId, MergedTreeId, TreeValue}; +use jj_lib::backend::CommitId; +use jj_lib::backend::CopyRecord; +use jj_lib::backend::FileId; +use jj_lib::backend::MergedTreeId; +use jj_lib::backend::TreeValue; use jj_lib::copies::CopyRecords; use jj_lib::files::MergeResult; -use jj_lib::matchers::{EverythingMatcher, FilesMatcher, Matcher, PrefixMatcher}; -use jj_lib::merge::{Merge, MergeBuilder, MergedTreeValue}; -use jj_lib::merged_tree::{ - MergedTree, MergedTreeBuilder, TreeDiffEntry, TreeDiffIterator, TreeDiffStreamImpl, -}; +use jj_lib::matchers::EverythingMatcher; +use jj_lib::matchers::FilesMatcher; +use jj_lib::matchers::Matcher; +use jj_lib::matchers::PrefixMatcher; +use jj_lib::merge::Merge; +use jj_lib::merge::MergeBuilder; +use jj_lib::merge::MergedTreeValue; +use jj_lib::merged_tree::MergedTree; +use jj_lib::merged_tree::MergedTreeBuilder; +use jj_lib::merged_tree::TreeDiffEntry; +use jj_lib::merged_tree::TreeDiffIterator; +use jj_lib::merged_tree::TreeDiffStreamImpl; use jj_lib::repo::Repo; -use jj_lib::repo_path::{RepoPath, RepoPathBuf, RepoPathComponent}; +use jj_lib::repo_path::RepoPath; +use jj_lib::repo_path::RepoPathBuf; +use jj_lib::repo_path::RepoPathComponent; use pollster::FutureExt as _; use pretty_assertions::assert_eq; -use testutils::{create_single_tree, write_file, TestRepo}; +use testutils::create_single_tree; +use testutils::write_file; +use testutils::TestRepo; fn file_value(file_id: &FileId) -> TreeValue { TreeValue::File { diff --git a/lib/tests/test_mut_repo.rs b/lib/tests/test_mut_repo.rs index baeb62bd8e..9ed017bfd2 100644 --- a/lib/tests/test_mut_repo.rs +++ b/lib/tests/test_mut_repo.rs @@ -13,12 +13,17 @@ // limitations under the License. use jj_lib::backend::CommitId; -use jj_lib::op_store::{RefTarget, RemoteRef, RemoteRefState, WorkspaceId}; +use jj_lib::op_store::RefTarget; +use jj_lib::op_store::RemoteRef; +use jj_lib::op_store::RemoteRefState; +use jj_lib::op_store::WorkspaceId; use jj_lib::repo::Repo; use maplit::hashset; -use testutils::{ - assert_rebased_onto, create_random_commit, write_random_commit, CommitGraphBuilder, TestRepo, -}; +use testutils::assert_rebased_onto; +use testutils::create_random_commit; +use testutils::write_random_commit; +use testutils::CommitGraphBuilder; +use testutils::TestRepo; #[test] fn test_edit() { diff --git a/lib/tests/test_operations.rs b/lib/tests/test_operations.rs index be3040ab63..19ffdad89e 100644 --- a/lib/tests/test_operations.rs +++ b/lib/tests/test_operations.rs @@ -21,11 +21,16 @@ use assert_matches::assert_matches; use itertools::Itertools as _; use jj_lib::backend::CommitId; use jj_lib::object_id::ObjectId; -use jj_lib::op_walk::{self, OpsetEvaluationError, OpsetResolutionError}; +use jj_lib::op_walk::OpsetEvaluationError; +use jj_lib::op_walk::OpsetResolutionError; +use jj_lib::op_walk::{self}; use jj_lib::operation::Operation; -use jj_lib::repo::{ReadonlyRepo, Repo}; +use jj_lib::repo::ReadonlyRepo; +use jj_lib::repo::Repo; use jj_lib::settings::UserSettings; -use testutils::{create_random_commit, write_random_commit, TestRepo}; +use testutils::create_random_commit; +use testutils::write_random_commit; +use testutils::TestRepo; fn list_dir(dir: &Path) -> Vec { std::fs::read_dir(dir) diff --git a/lib/tests/test_refs.rs b/lib/tests/test_refs.rs index 59fa06758a..a60c9d00cd 100644 --- a/lib/tests/test_refs.rs +++ b/lib/tests/test_refs.rs @@ -16,7 +16,8 @@ use jj_lib::merge::Merge; use jj_lib::op_store::RefTarget; use jj_lib::refs::merge_ref_targets; use jj_lib::repo::Repo; -use testutils::{CommitGraphBuilder, TestWorkspace}; +use testutils::CommitGraphBuilder; +use testutils::TestWorkspace; #[test] fn test_merge_ref_targets() { diff --git a/lib/tests/test_revset.rs b/lib/tests/test_revset.rs index 24c54958de..304c281bdc 100644 --- a/lib/tests/test_revset.rs +++ b/lib/tests/test_revset.rs @@ -18,28 +18,48 @@ use std::path::Path; use assert_matches::assert_matches; use chrono::DateTime; use itertools::Itertools; -use jj_lib::backend::{CommitId, MillisSinceEpoch, Signature, Timestamp}; +use jj_lib::backend::CommitId; +use jj_lib::backend::MillisSinceEpoch; +use jj_lib::backend::Signature; +use jj_lib::backend::Timestamp; use jj_lib::commit::Commit; use jj_lib::fileset::FilesetExpression; use jj_lib::git; use jj_lib::git_backend::GitBackend; -use jj_lib::graph::{GraphEdge, ReverseGraphIterator}; +use jj_lib::graph::GraphEdge; +use jj_lib::graph::ReverseGraphIterator; use jj_lib::object_id::ObjectId; -use jj_lib::op_store::{RefTarget, RemoteRef, RemoteRefState, WorkspaceId}; +use jj_lib::op_store::RefTarget; +use jj_lib::op_store::RemoteRef; +use jj_lib::op_store::RemoteRefState; +use jj_lib::op_store::WorkspaceId; use jj_lib::repo::Repo; -use jj_lib::repo_path::{RepoPath, RepoPathUiConverter}; -use jj_lib::revset::{ - optimize, parse, DefaultSymbolResolver, FailingSymbolResolver, ResolvedExpression, Revset, - RevsetAliasesMap, RevsetExpression, RevsetExtensions, RevsetFilterPredicate, - RevsetParseContext, RevsetResolutionError, RevsetWorkspaceContext, SymbolResolverExtension, -}; +use jj_lib::repo_path::RepoPath; +use jj_lib::repo_path::RepoPathUiConverter; +use jj_lib::revset::optimize; +use jj_lib::revset::parse; +use jj_lib::revset::DefaultSymbolResolver; +use jj_lib::revset::FailingSymbolResolver; +use jj_lib::revset::ResolvedExpression; +use jj_lib::revset::Revset; +use jj_lib::revset::RevsetAliasesMap; +use jj_lib::revset::RevsetExpression; +use jj_lib::revset::RevsetExtensions; +use jj_lib::revset::RevsetFilterPredicate; +use jj_lib::revset::RevsetParseContext; +use jj_lib::revset::RevsetResolutionError; +use jj_lib::revset::RevsetWorkspaceContext; +use jj_lib::revset::SymbolResolverExtension; use jj_lib::settings::GitSettings; use jj_lib::workspace::Workspace; use test_case::test_case; -use testutils::{ - create_random_commit, create_tree, write_random_commit, CommitGraphBuilder, TestRepo, - TestRepoBackend, TestWorkspace, -}; +use testutils::create_random_commit; +use testutils::create_tree; +use testutils::write_random_commit; +use testutils::CommitGraphBuilder; +use testutils::TestRepo; +use testutils::TestRepoBackend; +use testutils::TestWorkspace; fn resolve_symbol_with_extensions( repo: &dyn Repo, diff --git a/lib/tests/test_rewrite.rs b/lib/tests/test_rewrite.rs index 417bc38a06..269adf6b1e 100644 --- a/lib/tests/test_rewrite.rs +++ b/lib/tests/test_rewrite.rs @@ -14,20 +14,30 @@ use itertools::Itertools as _; use jj_lib::commit::Commit; -use jj_lib::matchers::{EverythingMatcher, FilesMatcher}; +use jj_lib::matchers::EverythingMatcher; +use jj_lib::matchers::FilesMatcher; use jj_lib::merged_tree::MergedTree; -use jj_lib::op_store::{RefTarget, RemoteRef, RemoteRefState, WorkspaceId}; +use jj_lib::op_store::RefTarget; +use jj_lib::op_store::RemoteRef; +use jj_lib::op_store::RemoteRefState; +use jj_lib::op_store::WorkspaceId; use jj_lib::repo::Repo; use jj_lib::repo_path::RepoPath; -use jj_lib::rewrite::{ - rebase_commit_with_options, restore_tree, CommitRewriter, EmptyBehaviour, RebaseOptions, -}; -use maplit::{hashmap, hashset}; +use jj_lib::rewrite::rebase_commit_with_options; +use jj_lib::rewrite::restore_tree; +use jj_lib::rewrite::CommitRewriter; +use jj_lib::rewrite::EmptyBehaviour; +use jj_lib::rewrite::RebaseOptions; +use maplit::hashmap; +use maplit::hashset; use test_case::test_case; -use testutils::{ - assert_abandoned_with_parent, assert_rebased_onto, create_random_commit, create_tree, - write_random_commit, CommitGraphBuilder, TestRepo, -}; +use testutils::assert_abandoned_with_parent; +use testutils::assert_rebased_onto; +use testutils::create_random_commit; +use testutils::create_tree; +use testutils::write_random_commit; +use testutils::CommitGraphBuilder; +use testutils::TestRepo; #[test] fn test_restore_tree() { diff --git a/lib/tests/test_rewrite_transform.rs b/lib/tests/test_rewrite_transform.rs index 87daa97750..fe2138f2e9 100644 --- a/lib/tests/test_rewrite_transform.rs +++ b/lib/tests/test_rewrite_transform.rs @@ -16,7 +16,8 @@ use std::collections::HashMap; use jj_lib::repo::Repo; use maplit::hashset; -use testutils::{CommitGraphBuilder, TestRepo}; +use testutils::CommitGraphBuilder; +use testutils::TestRepo; // Simulate some `jj sync` command that rebases B:: onto G while abandoning C // (because it's presumably already in G). diff --git a/lib/tests/test_signing.rs b/lib/tests/test_signing.rs index 0c79a0e807..6698837aad 100644 --- a/lib/tests/test_signing.rs +++ b/lib/tests/test_signing.rs @@ -1,10 +1,18 @@ -use jj_lib::backend::{MillisSinceEpoch, Signature, Timestamp}; +use jj_lib::backend::MillisSinceEpoch; +use jj_lib::backend::Signature; +use jj_lib::backend::Timestamp; use jj_lib::repo::Repo; use jj_lib::settings::UserSettings; -use jj_lib::signing::{SigStatus, SignBehavior, Signer, Verification}; +use jj_lib::signing::SigStatus; +use jj_lib::signing::SignBehavior; +use jj_lib::signing::Signer; +use jj_lib::signing::Verification; use test_case::test_case; +use testutils::create_random_commit; use testutils::test_signing_backend::TestSigningBackend; -use testutils::{create_random_commit, write_random_commit, TestRepoBackend, TestWorkspace}; +use testutils::write_random_commit; +use testutils::TestRepoBackend; +use testutils::TestWorkspace; fn user_settings(sign_all: bool) -> UserSettings { let config = testutils::base_config() diff --git a/lib/tests/test_ssh_signing.rs b/lib/tests/test_ssh_signing.rs index 1bab07343b..83d75dba05 100644 --- a/lib/tests/test_ssh_signing.rs +++ b/lib/tests/test_ssh_signing.rs @@ -18,9 +18,11 @@ use std::fs::Permissions; use std::io::Write; #[cfg(unix)] use std::os::unix::prelude::PermissionsExt; -use std::path::{Path, PathBuf}; +use std::path::Path; +use std::path::PathBuf; -use jj_lib::signing::{SigStatus, SigningBackend}; +use jj_lib::signing::SigStatus; +use jj_lib::signing::SigningBackend; use jj_lib::ssh_signing::SshBackend; static PRIVATE_KEY: &str = r#"-----BEGIN OPENSSH PRIVATE KEY----- diff --git a/lib/tests/test_view.rs b/lib/tests/test_view.rs index 029473cc41..ea2e4281ac 100644 --- a/lib/tests/test_view.rs +++ b/lib/tests/test_view.rs @@ -14,13 +14,20 @@ use std::collections::BTreeMap; -use jj_lib::op_store::{BranchTarget, RefTarget, RemoteRef, RemoteRefState, WorkspaceId}; +use jj_lib::op_store::BranchTarget; +use jj_lib::op_store::RefTarget; +use jj_lib::op_store::RemoteRef; +use jj_lib::op_store::RemoteRefState; +use jj_lib::op_store::WorkspaceId; use jj_lib::repo::Repo; -use maplit::{btreemap, hashset}; +use maplit::btreemap; +use maplit::hashset; use test_case::test_case; -use testutils::{ - commit_transactions, create_random_commit, write_random_commit, CommitGraphBuilder, TestRepo, -}; +use testutils::commit_transactions; +use testutils::create_random_commit; +use testutils::write_random_commit; +use testutils::CommitGraphBuilder; +use testutils::TestRepo; #[test] fn test_heads_empty() { diff --git a/lib/tests/test_workspace.rs b/lib/tests/test_workspace.rs index 63c0e5250c..4be3d1b8cc 100644 --- a/lib/tests/test_workspace.rs +++ b/lib/tests/test_workspace.rs @@ -17,10 +17,12 @@ use std::thread; use assert_matches::assert_matches; use jj_lib::op_store::WorkspaceId; use jj_lib::repo::Repo; -use jj_lib::workspace::{ - default_working_copy_factories, default_working_copy_factory, Workspace, WorkspaceLoadError, -}; -use testutils::{TestRepo, TestWorkspace}; +use jj_lib::workspace::default_working_copy_factories; +use jj_lib::workspace::default_working_copy_factory; +use jj_lib::workspace::Workspace; +use jj_lib::workspace::WorkspaceLoadError; +use testutils::TestRepo; +use testutils::TestWorkspace; #[test] fn test_load_bad_path() { diff --git a/lib/testutils/src/lib.rs b/lib/testutils/src/lib.rs index e5283d1b91..2fbec65d57 100644 --- a/lib/testutils/src/lib.rs +++ b/lib/testutils/src/lib.rs @@ -14,24 +14,40 @@ use std::collections::HashMap; use std::env; -use std::fs::{self, OpenOptions}; -use std::io::{Read, Write}; -use std::path::{Path, PathBuf}; -use std::sync::{Arc, Once}; +use std::fs::OpenOptions; +use std::fs::{self}; +use std::io::Read; +use std::io::Write; +use std::path::Path; +use std::path::PathBuf; +use std::sync::Arc; +use std::sync::Once; use itertools::Itertools; -use jj_lib::backend::{ - self, Backend, BackendInitError, ChangeId, CommitId, FileId, MergedTreeId, MillisSinceEpoch, - Signature, Timestamp, TreeValue, -}; +use jj_lib::backend::Backend; +use jj_lib::backend::BackendInitError; +use jj_lib::backend::ChangeId; +use jj_lib::backend::CommitId; +use jj_lib::backend::FileId; +use jj_lib::backend::MergedTreeId; +use jj_lib::backend::MillisSinceEpoch; +use jj_lib::backend::Signature; +use jj_lib::backend::Timestamp; +use jj_lib::backend::TreeValue; +use jj_lib::backend::{self}; use jj_lib::commit::Commit; use jj_lib::commit_builder::CommitBuilder; use jj_lib::git_backend::GitBackend; use jj_lib::local_backend::LocalBackend; use jj_lib::merged_tree::MergedTree; use jj_lib::object_id::ObjectId; -use jj_lib::repo::{MutableRepo, ReadonlyRepo, Repo, RepoLoader, StoreFactories}; -use jj_lib::repo_path::{RepoPath, RepoPathBuf}; +use jj_lib::repo::MutableRepo; +use jj_lib::repo::ReadonlyRepo; +use jj_lib::repo::Repo; +use jj_lib::repo::RepoLoader; +use jj_lib::repo::StoreFactories; +use jj_lib::repo_path::RepoPath; +use jj_lib::repo_path::RepoPathBuf; use jj_lib::secret_backend::SecretBackend; use jj_lib::settings::UserSettings; use jj_lib::signing::Signer; @@ -39,7 +55,8 @@ use jj_lib::store::Store; use jj_lib::transaction::Transaction; use jj_lib::tree::Tree; use jj_lib::tree_builder::TreeBuilder; -use jj_lib::working_copy::{SnapshotError, SnapshotOptions}; +use jj_lib::working_copy::SnapshotError; +use jj_lib::working_copy::SnapshotOptions; use jj_lib::workspace::Workspace; use tempfile::TempDir; diff --git a/lib/testutils/src/test_backend.rs b/lib/testutils/src/test_backend.rs index 5a109ab767..6fc7c49abe 100644 --- a/lib/testutils/src/test_backend.rs +++ b/lib/testutils/src/test_backend.rs @@ -14,21 +14,41 @@ use std::any::Any; use std::collections::HashMap; -use std::fmt::{Debug, Error, Formatter}; -use std::io::{Cursor, Read}; -use std::path::{Path, PathBuf}; -use std::sync::{Arc, Mutex, MutexGuard, OnceLock}; +use std::fmt::Debug; +use std::fmt::Error; +use std::fmt::Formatter; +use std::io::Cursor; +use std::io::Read; +use std::path::Path; +use std::path::PathBuf; +use std::sync::Arc; +use std::sync::Mutex; +use std::sync::MutexGuard; +use std::sync::OnceLock; use std::time::SystemTime; use async_trait::async_trait; use futures::stream::BoxStream; -use jj_lib::backend::{ - make_root_commit, Backend, BackendError, BackendResult, ChangeId, Commit, CommitId, Conflict, - ConflictId, CopyRecord, FileId, SecureSig, SigningFn, SymlinkId, Tree, TreeId, -}; +use jj_lib::backend::make_root_commit; +use jj_lib::backend::Backend; +use jj_lib::backend::BackendError; +use jj_lib::backend::BackendResult; +use jj_lib::backend::ChangeId; +use jj_lib::backend::Commit; +use jj_lib::backend::CommitId; +use jj_lib::backend::Conflict; +use jj_lib::backend::ConflictId; +use jj_lib::backend::CopyRecord; +use jj_lib::backend::FileId; +use jj_lib::backend::SecureSig; +use jj_lib::backend::SigningFn; +use jj_lib::backend::SymlinkId; +use jj_lib::backend::Tree; +use jj_lib::backend::TreeId; use jj_lib::index::Index; use jj_lib::object_id::ObjectId; -use jj_lib::repo_path::{RepoPath, RepoPathBuf}; +use jj_lib::repo_path::RepoPath; +use jj_lib::repo_path::RepoPathBuf; const HASH_LENGTH: usize = 10; const CHANGE_ID_LENGTH: usize = 16; diff --git a/lib/testutils/src/test_signing_backend.rs b/lib/testutils/src/test_signing_backend.rs index af6c7e5dd0..8d1d3369b9 100644 --- a/lib/testutils/src/test_signing_backend.rs +++ b/lib/testutils/src/test_signing_backend.rs @@ -1,6 +1,10 @@ use hex::ToHex; use jj_lib::content_hash::blake2b_hash; -use jj_lib::signing::{SigStatus, SignError, SignResult, SigningBackend, Verification}; +use jj_lib::signing::SigStatus; +use jj_lib::signing::SignError; +use jj_lib::signing::SignResult; +use jj_lib::signing::SigningBackend; +use jj_lib::signing::Verification; #[derive(Debug)] pub struct TestSigningBackend; diff --git a/rustfmt.toml b/rustfmt.toml index ebf4bed4da..1fd3e2f187 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -4,4 +4,4 @@ wrap_comments = true format_strings = true error_on_line_overflow = true group_imports = "StdExternalCrate" -imports_granularity = "Module" +imports_granularity = "Item"