diff --git a/lib/build.rs b/lib/build.rs index a78929024..56e497b67 100644 --- a/lib/build.rs +++ b/lib/build.rs @@ -14,9 +14,10 @@ extern crate protobuf_codegen_pure; -use protobuf_codegen_pure::Customize; use std::path::Path; +use protobuf_codegen_pure::Customize; + fn main() { let out_dir = format!("{}/protos", std::env::var("OUT_DIR").unwrap()); diff --git a/lib/src/commit_builder.rs b/lib/src/commit_builder.rs index 9da6e65e2..6b82ca4f2 100644 --- a/lib/src/commit_builder.rs +++ b/lib/src/commit_builder.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::sync::Arc; + use uuid::Uuid; use crate::commit::Commit; @@ -21,7 +23,6 @@ use crate::store; use crate::store::{ChangeId, CommitId, Signature, Timestamp, TreeId}; use crate::store_wrapper::StoreWrapper; use crate::transaction::Transaction; -use std::sync::Arc; #[derive(Debug)] pub struct CommitBuilder { diff --git a/lib/src/conflicts.rs b/lib/src/conflicts.rs index 5c12e5add..46cdcff7c 100644 --- a/lib/src/conflicts.rs +++ b/lib/src/conflicts.rs @@ -12,11 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::io::{Cursor, Write}; + use crate::files; use crate::repo_path::RepoPath; use crate::store::{Conflict, TreeValue}; use crate::store_wrapper::StoreWrapper; -use std::io::{Cursor, Write}; pub fn materialize_conflict( store: &StoreWrapper, diff --git a/lib/src/dag_walk.rs b/lib/src/dag_walk.rs index 38f0dcd94..0d9c8dfd1 100644 --- a/lib/src/dag_walk.rs +++ b/lib/src/dag_walk.rs @@ -13,11 +13,11 @@ // limitations under the License. use std::collections::HashSet; +use std::hash::Hash; use std::iter::Iterator; use crate::commit::Commit; use crate::store::CommitId; -use std::hash::Hash; pub struct AncestorsIter { bfs_iter: BfsIter<'static, 'static, Commit, CommitId, Vec>, diff --git a/lib/src/files.rs b/lib/src/files.rs index 8236a7e40..599e81d80 100644 --- a/lib/src/files.rs +++ b/lib/src/files.rs @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -use diff::slice as diff_slice; use std::fmt::{Debug, Error, Formatter}; use std::ops::Range; +use diff::slice as diff_slice; + fn is_word_byte(a: u8) -> bool { a.is_ascii_alphanumeric() || a == b'_' } diff --git a/lib/src/git.rs b/lib/src/git.rs index a095bccbe..9c1cf3104 100644 --- a/lib/src/git.rs +++ b/lib/src/git.rs @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +use thiserror::Error; + use crate::commit::Commit; use crate::store::CommitId; use crate::transaction::Transaction; -use thiserror::Error; #[derive(Error, Debug, PartialEq)] pub enum GitImportError { diff --git a/lib/src/git_store.rs b/lib/src/git_store.rs index 5b6fc599f..c166bab22 100644 --- a/lib/src/git_store.rs +++ b/lib/src/git_store.rs @@ -15,21 +15,21 @@ use std::fmt::{Debug, Error, Formatter}; use std::io::Cursor; use std::io::Read; +use std::ops::Deref; use std::path::Path; use std::sync::Mutex; use std::time::Duration; +use backoff::{ExponentialBackoff, Operation}; use git2::Oid; use protobuf::Message; +use uuid::Uuid; use crate::repo_path::{DirRepoPath, FileRepoPath}; use crate::store::{ ChangeId, Commit, CommitId, Conflict, ConflictId, ConflictPart, FileId, MillisSinceEpoch, Signature, Store, StoreError, StoreResult, SymlinkId, Timestamp, Tree, TreeId, TreeValue, }; -use backoff::{ExponentialBackoff, Operation}; -use std::ops::Deref; -use uuid::Uuid; /// Ref namespace used only for preventing GC. const NO_GC_REF_NAMESPACE: &str = "refs/jj/keep/"; @@ -489,9 +489,8 @@ fn bytes_vec_from_json(value: &serde_json::Value) -> Vec { #[cfg(test)] mod tests { - use crate::store::{FileId, MillisSinceEpoch}; - use super::*; + use crate::store::{FileId, MillisSinceEpoch}; #[test] fn read_plain_git_commit() { diff --git a/lib/src/index.rs b/lib/src/index.rs index 8a1708e5c..d609480ae 100644 --- a/lib/src/index.rs +++ b/lib/src/index.rs @@ -16,9 +16,11 @@ extern crate byteorder; use std::cmp::{max, min, Ordering}; use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashSet}; +use std::fmt::{Debug, Formatter}; use std::fs::File; use std::io; use std::io::{Cursor, Read, Write}; +use std::ops::Bound; use std::path::PathBuf; use std::sync::Arc; @@ -27,12 +29,8 @@ use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; use tempfile::NamedTempFile; use crate::commit::Commit; - use crate::store::{ChangeId, CommitId}; -use std::fmt::{Debug, Formatter}; -use std::ops::Bound; - #[derive(Clone)] pub enum IndexRef<'a> { Readonly(Arc), @@ -1485,9 +1483,9 @@ impl ReadonlyIndex { #[cfg(test)] mod tests { - use super::*; use test_case::test_case; + use super::*; use crate::commit_builder::new_change_id; #[test_case(false; "memory")] diff --git a/lib/src/index_store.rs b/lib/src/index_store.rs index eed998e7d..56c45761b 100644 --- a/lib/src/index_store.rs +++ b/lib/src/index_store.rs @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::collections::{HashMap, HashSet}; +use std::fs::File; +use std::io; +use std::io::{Read, Write}; +use std::path::PathBuf; +use std::sync::Arc; + +use tempfile::NamedTempFile; + use crate::commit::Commit; use crate::dag_walk; use crate::index::{MutableIndex, ReadonlyIndex}; @@ -19,13 +28,6 @@ use crate::op_store::OperationId; use crate::operation::Operation; use crate::store::CommitId; use crate::store_wrapper::StoreWrapper; -use std::collections::{HashMap, HashSet}; -use std::fs::File; -use std::io; -use std::io::{Read, Write}; -use std::path::PathBuf; -use std::sync::Arc; -use tempfile::NamedTempFile; pub struct IndexStore { dir: PathBuf, diff --git a/lib/src/lock.rs b/lib/src/lock.rs index 7dc527dd7..08dc938ec 100644 --- a/lib/src/lock.rs +++ b/lib/src/lock.rs @@ -12,11 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -use backoff::{ExponentialBackoff, Operation}; use std::fs::{File, OpenOptions}; use std::path::PathBuf; use std::time::Duration; +use backoff::{ExponentialBackoff, Operation}; + pub struct FileLock { path: PathBuf, _file: File, diff --git a/lib/src/op_heads_store.rs b/lib/src/op_heads_store.rs index 87738b075..22fccf3d0 100644 --- a/lib/src/op_heads_store.rs +++ b/lib/src/op_heads_store.rs @@ -12,19 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::collections::HashSet; +use std::path::PathBuf; +use std::sync::Arc; + +use thiserror::Error; + use crate::dag_walk; use crate::lock::FileLock; use crate::op_store; use crate::op_store::{OpStore, OperationId, OperationMetadata}; use crate::operation::Operation; -use crate::transaction::UnpublishedOperation; -use std::path::PathBuf; -use std::sync::Arc; - use crate::repo::RepoLoader; use crate::store::{CommitId, Timestamp}; -use std::collections::HashSet; -use thiserror::Error; +use crate::transaction::UnpublishedOperation; /// Manages the very set of current heads of the operation log. The store is /// simply a directory where each operation id is a file with that name (and no diff --git a/lib/src/op_store.rs b/lib/src/op_store.rs index 7505ee61e..8d5761f9f 100644 --- a/lib/src/op_store.rs +++ b/lib/src/op_store.rs @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::store::{CommitId, Timestamp}; use std::collections::{BTreeMap, HashSet}; use std::fmt::{Debug, Error, Formatter}; +use crate::store::{CommitId, Timestamp}; + #[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash)] pub struct ViewId(pub Vec); diff --git a/lib/src/operation.rs b/lib/src/operation.rs index 9e0cb7905..b481ae43f 100644 --- a/lib/src/operation.rs +++ b/lib/src/operation.rs @@ -12,15 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::op_store; -use crate::op_store::{OpStore, OperationId, ViewId}; -use crate::store::CommitId; use std::cmp::Ordering; use std::collections::HashSet; use std::fmt::{Debug, Error, Formatter}; use std::hash::{Hash, Hasher}; use std::sync::Arc; +use crate::op_store; +use crate::op_store::{OpStore, OperationId, ViewId}; +use crate::store::CommitId; + #[derive(Clone)] pub struct Operation { op_store: Arc, diff --git a/lib/src/repo.rs b/lib/src/repo.rs index f0a875c19..6bbc62379 100644 --- a/lib/src/repo.rs +++ b/lib/src/repo.rs @@ -19,11 +19,11 @@ use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::sync::{Arc, Mutex, MutexGuard}; -use crate::conflicts; use thiserror::Error; use crate::commit::Commit; use crate::commit_builder::{new_change_id, signature, CommitBuilder}; +use crate::conflicts; use crate::dag_walk::topo_order_reverse; use crate::evolution::{EvolutionRef, MutableEvolution, ReadonlyEvolution}; use crate::git_store::GitStore; diff --git a/lib/src/store.rs b/lib/src/store.rs index 788227821..115cae039 100644 --- a/lib/src/store.rs +++ b/lib/src/store.rs @@ -12,16 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::borrow::Borrow; use std::collections::BTreeMap; use std::fmt::{Debug, Error, Formatter}; use std::io::Read; use std::result::Result; use std::vec::Vec; +use thiserror::Error; + use crate::repo_path::DirRepoPath; use crate::repo_path::FileRepoPath; -use std::borrow::Borrow; -use thiserror::Error; #[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash)] pub struct CommitId(pub Vec); diff --git a/lib/src/store_wrapper.rs b/lib/src/store_wrapper.rs index 2304c74ee..c247c4d6c 100644 --- a/lib/src/store_wrapper.rs +++ b/lib/src/store_wrapper.rs @@ -13,6 +13,7 @@ // limitations under the License. use std::collections::HashMap; +use std::io::Read; use std::sync::{Arc, RwLock, Weak}; use crate::commit::Commit; @@ -24,7 +25,6 @@ use crate::store::{ }; use crate::tree::Tree; use crate::tree_builder::TreeBuilder; -use std::io::Read; /// Wraps the low-level store and makes it return more convenient types. Also /// adds the root commit and adds caching. diff --git a/lib/src/transaction.rs b/lib/src/transaction.rs index e97db961d..6bb0a36c3 100644 --- a/lib/src/transaction.rs +++ b/lib/src/transaction.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::sync::Arc; + use crate::commit::Commit; use crate::evolution::MutableEvolution; use crate::index::MutableIndex; @@ -26,7 +28,6 @@ use crate::store; use crate::store::{CommitId, Timestamp}; use crate::store_wrapper::StoreWrapper; use crate::view::MutableView; -use std::sync::Arc; pub struct Transaction<'r> { repo: Option>>, diff --git a/lib/src/tree.rs b/lib/src/tree.rs index 78191a510..599fbf448 100644 --- a/lib/src/tree.rs +++ b/lib/src/tree.rs @@ -14,6 +14,7 @@ use std::borrow::Borrow; use std::fmt::{Debug, Error, Formatter}; +use std::pin::Pin; use std::sync::Arc; use crate::matchers::AlwaysMatcher; @@ -24,7 +25,6 @@ use crate::store; use crate::store::{ConflictId, TreeEntriesNonRecursiveIter, TreeEntry, TreeId, TreeValue}; use crate::store_wrapper::StoreWrapper; use crate::trees::{recursive_tree_diff, TreeValueDiff}; -use std::pin::Pin; #[derive(Clone)] pub struct Tree { diff --git a/lib/src/tree_builder.rs b/lib/src/tree_builder.rs index 20953918c..501d08cfb 100644 --- a/lib/src/tree_builder.rs +++ b/lib/src/tree_builder.rs @@ -13,13 +13,13 @@ // limitations under the License. use std::collections::{BTreeMap, HashSet}; +use std::sync::Arc; use crate::repo_path::{DirRepoPath, RepoPath, RepoPathJoin}; use crate::store; use crate::store::{TreeId, TreeValue}; use crate::store_wrapper::StoreWrapper; use crate::tree::Tree; -use std::sync::Arc; #[derive(Debug)] enum Override { diff --git a/lib/src/trees.rs b/lib/src/trees.rs index f761047c4..c1fea0c39 100644 --- a/lib/src/trees.rs +++ b/lib/src/trees.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::cmp::Ordering; + use crate::files; use crate::files::MergeResult; use crate::matchers::Matcher; @@ -21,7 +23,6 @@ use crate::repo_path::{ use crate::store::{Conflict, ConflictPart, StoreError, TreeId, TreeValue}; use crate::store_wrapper::StoreWrapper; use crate::tree::Tree; -use std::cmp::Ordering; #[derive(Debug, PartialEq, Eq, Clone)] pub enum Diff { diff --git a/lib/src/view.rs b/lib/src/view.rs index c32ebcbb3..00f3a83be 100644 --- a/lib/src/view.rs +++ b/lib/src/view.rs @@ -18,7 +18,6 @@ use std::sync::Arc; use crate::commit::Commit; use crate::op_store; - use crate::store::CommitId; use crate::store_wrapper::StoreWrapper; diff --git a/lib/src/working_copy.rs b/lib/src/working_copy.rs index e896fc8c2..4e77e6cb5 100644 --- a/lib/src/working_copy.rs +++ b/lib/src/working_copy.rs @@ -25,8 +25,10 @@ use std::os::unix::fs::PermissionsExt; use std::os::windows::fs::symlink_file; use std::path::Path; use std::path::PathBuf; +use std::sync::Arc; use std::time::UNIX_EPOCH; +use git2::{Repository, RepositoryInitOptions}; use protobuf::Message; use tempfile::NamedTempFile; use thiserror::Error; @@ -42,8 +44,6 @@ use crate::settings::UserSettings; use crate::store::{CommitId, FileId, MillisSinceEpoch, StoreError, SymlinkId, TreeId, TreeValue}; use crate::store_wrapper::StoreWrapper; use crate::trees::TreeValueDiff; -use git2::{Repository, RepositoryInitOptions}; -use std::sync::Arc; #[derive(Debug, PartialEq, Eq, Clone)] pub enum FileType { diff --git a/lib/tests/test_bad_locking.rs b/lib/tests/test_bad_locking.rs index ca61c9a50..ed377f90a 100644 --- a/lib/tests/test_bad_locking.rs +++ b/lib/tests/test_bad_locking.rs @@ -13,12 +13,11 @@ // limitations under the License. use std::path::Path; - -use tempfile::TempDir; +use std::sync::Arc; use jujube_lib::repo::ReadonlyRepo; use jujube_lib::testutils; -use std::sync::Arc; +use tempfile::TempDir; use test_case::test_case; fn copy_directory(src: &Path, dst: &Path) { diff --git a/lib/tests/test_commit_builder.rs b/lib/tests/test_commit_builder.rs index 3ae7f7fd7..7694c86dc 100644 --- a/lib/tests/test_commit_builder.rs +++ b/lib/tests/test_commit_builder.rs @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::sync::Arc; + use jujube_lib::commit_builder::CommitBuilder; use jujube_lib::repo_path::FileRepoPath; use jujube_lib::settings::UserSettings; use jujube_lib::testutils; use jujube_lib::tree::DiffSummary; -use std::sync::Arc; use test_case::test_case; #[test_case(false ; "local store")] diff --git a/lib/tests/test_commit_concurrent.rs b/lib/tests/test_commit_concurrent.rs index 11fe79b6c..68bec48b9 100644 --- a/lib/tests/test_commit_concurrent.rs +++ b/lib/tests/test_commit_concurrent.rs @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::sync::Arc; use std::thread; use jujube_lib::dag_walk; use jujube_lib::repo::ReadonlyRepo; use jujube_lib::testutils; -use std::sync::Arc; use test_case::test_case; fn count_non_merge_operations(repo: &ReadonlyRepo) -> u32 { diff --git a/lib/tests/test_git.rs b/lib/tests/test_git.rs index 42f89f5c6..f2a3d3aef 100644 --- a/lib/tests/test_git.rs +++ b/lib/tests/test_git.rs @@ -12,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::collections::HashSet; +use std::path::PathBuf; +use std::sync::Arc; + use git2::Oid; use jujube_lib::commit::Commit; use jujube_lib::git; @@ -21,9 +25,6 @@ use jujube_lib::settings::UserSettings; use jujube_lib::store::CommitId; use jujube_lib::testutils; use maplit::hashset; -use std::collections::HashSet; -use std::path::PathBuf; -use std::sync::Arc; use tempfile::TempDir; fn empty_git_commit<'r>( diff --git a/lib/tests/test_index.rs b/lib/tests/test_index.rs index 920f80a58..22887ae19 100644 --- a/lib/tests/test_index.rs +++ b/lib/tests/test_index.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::sync::Arc; + use jujube_lib::commit::Commit; use jujube_lib::commit_builder::CommitBuilder; use jujube_lib::index::IndexRef; @@ -20,7 +22,6 @@ use jujube_lib::settings::UserSettings; use jujube_lib::store::CommitId; use jujube_lib::testutils; use jujube_lib::testutils::create_random_commit; -use std::sync::Arc; use test_case::test_case; #[must_use] diff --git a/lib/tests/test_load_repo.rs b/lib/tests/test_load_repo.rs index 339f016af..8c43d16ca 100644 --- a/lib/tests/test_load_repo.rs +++ b/lib/tests/test_load_repo.rs @@ -12,9 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::sync::Arc; + use jujube_lib::repo::{ReadonlyRepo, RepoLoadError, RepoLoader}; use jujube_lib::testutils; -use std::sync::Arc; use test_case::test_case; #[test] diff --git a/lib/tests/test_operations.rs b/lib/tests/test_operations.rs index ff0a3bf45..8034731f0 100644 --- a/lib/tests/test_operations.rs +++ b/lib/tests/test_operations.rs @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::path::Path; +use std::sync::Arc; + use jujube_lib::commit_builder::CommitBuilder; use jujube_lib::repo::RepoRef; use jujube_lib::store::CommitId; use jujube_lib::testutils; -use std::path::Path; -use std::sync::Arc; use test_case::test_case; fn list_dir(dir: &Path) -> Vec { diff --git a/lib/tests/test_transaction.rs b/lib/tests/test_transaction.rs index d0f4a0b15..891ffaceb 100644 --- a/lib/tests/test_transaction.rs +++ b/lib/tests/test_transaction.rs @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::sync::Arc; + use jujube_lib::commit_builder::CommitBuilder; use jujube_lib::repo_path::FileRepoPath; use jujube_lib::store::{Conflict, ConflictId, ConflictPart, TreeValue}; use jujube_lib::store_wrapper::StoreWrapper; use jujube_lib::testutils; -use std::sync::Arc; use test_case::test_case; // TODO Many of the tests here are not run with Git because they end up creating diff --git a/lib/tests/test_working_copy.rs b/lib/tests/test_working_copy.rs index bf5f154d3..7aec37290 100644 --- a/lib/tests/test_working_copy.rs +++ b/lib/tests/test_working_copy.rs @@ -12,8 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::fs::OpenOptions; +use std::io::Write; #[cfg(unix)] use std::os::unix::fs::PermissionsExt; +use std::sync::Arc; use jujube_lib::commit_builder::CommitBuilder; use jujube_lib::repo::ReadonlyRepo; @@ -22,9 +25,6 @@ use jujube_lib::settings::UserSettings; use jujube_lib::store::TreeValue; use jujube_lib::testutils; use jujube_lib::tree_builder::TreeBuilder; -use std::fs::OpenOptions; -use std::io::Write; -use std::sync::Arc; use test_case::test_case; #[test_case(false ; "local store")] diff --git a/lib/tests/test_working_copy_concurrent.rs b/lib/tests/test_working_copy_concurrent.rs index d2d622400..55ff47adf 100644 --- a/lib/tests/test_working_copy_concurrent.rs +++ b/lib/tests/test_working_copy_concurrent.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::collections::HashSet; +use std::sync::Arc; use std::thread; use jujube_lib::commit_builder::CommitBuilder; @@ -20,8 +22,6 @@ use jujube_lib::repo_path::FileRepoPath; use jujube_lib::store::CommitId; use jujube_lib::testutils; use jujube_lib::working_copy::CheckoutError; -use std::collections::HashSet; -use std::sync::Arc; use test_case::test_case; #[test_case(false ; "local store")] diff --git a/rustfmt.toml b/rustfmt.toml index 8b287f1a7..b8d5849ba 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,3 +1,4 @@ max_width = 100 wrap_comments = true error_on_line_overflow = true +group_imports = "StdExternalCrate" diff --git a/src/commands.rs b/src/commands.rs index c2edcadb1..90bc1477e 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -18,19 +18,17 @@ extern crate config; use std::collections::{HashSet, VecDeque}; use std::ffi::OsString; +use std::fmt::Debug; use std::fs; use std::fs::OpenOptions; use std::io; use std::io::{Read, Write}; use std::process::Command; use std::sync::Arc; +use std::time::Instant; use clap::{crate_version, App, Arg, ArgMatches, SubCommand}; - use criterion::Criterion; - -use pest::Parser; - use jujube_lib::commit::Commit; use jujube_lib::commit_builder::CommitBuilder; use jujube_lib::conflicts; @@ -40,16 +38,23 @@ use jujube_lib::evolution::EvolveListener; use jujube_lib::files; use jujube_lib::files::DiffLine; use jujube_lib::git; +use jujube_lib::git::GitFetchError; +use jujube_lib::index::{HexPrefix, PrefixResolution}; use jujube_lib::op_store::{OpStore, OpStoreError, OperationId}; +use jujube_lib::operation::Operation; use jujube_lib::repo::{ReadonlyRepo, RepoLoadError, RepoLoader}; use jujube_lib::repo_path::RepoPath; use jujube_lib::rewrite::{back_out_commit, merge_commit_trees, rebase_commit}; use jujube_lib::settings::UserSettings; use jujube_lib::store::{CommitId, Timestamp}; use jujube_lib::store::{StoreError, TreeValue}; +use jujube_lib::store_wrapper::StoreWrapper; +use jujube_lib::transaction::Transaction; use jujube_lib::tree::Tree; use jujube_lib::trees::TreeValueDiff; +use jujube_lib::view::merge_views; use jujube_lib::working_copy::{CheckoutStats, WorkingCopy}; +use pest::Parser; use self::chrono::{FixedOffset, TimeZone, Utc}; use crate::commands::CommandError::UserError; @@ -59,14 +64,6 @@ use crate::styler::{ColorStyler, Styler}; use crate::template_parser::TemplateParser; use crate::templater::Template; use crate::ui::Ui; -use jujube_lib::git::GitFetchError; -use jujube_lib::index::{HexPrefix, PrefixResolution}; -use jujube_lib::operation::Operation; -use jujube_lib::store_wrapper::StoreWrapper; -use jujube_lib::transaction::Transaction; -use jujube_lib::view::merge_views; -use std::fmt::Debug; -use std::time::Instant; enum CommandError { UserError(String), diff --git a/src/diff_edit.rs b/src/diff_edit.rs index 2a284e6d0..8b136c8d1 100644 --- a/src/diff_edit.rs +++ b/src/diff_edit.rs @@ -12,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::path::{Path, PathBuf}; +use std::process::Command; +use std::sync::Arc; + use jujube_lib::repo_path::{DirRepoPath, RepoPath}; use jujube_lib::store::{StoreError, TreeId, TreeValue}; use jujube_lib::store_wrapper::StoreWrapper; @@ -19,9 +23,6 @@ use jujube_lib::tree::Tree; use jujube_lib::tree_builder::TreeBuilder; use jujube_lib::trees::merge_trees; use jujube_lib::working_copy::{CheckoutError, TreeState}; -use std::path::{Path, PathBuf}; -use std::process::Command; -use std::sync::Arc; use tempfile::tempdir; use thiserror::Error; diff --git a/src/graphlog.rs b/src/graphlog.rs index f27ffdbfe..c179724c3 100644 --- a/src/graphlog.rs +++ b/src/graphlog.rs @@ -285,9 +285,10 @@ where #[cfg(test)] mod tests { - use super::*; use indoc::indoc; + use super::*; + #[test] fn single_node() { let mut buffer = vec![]; diff --git a/src/template_parser.rs b/src/template_parser.rs index 58a5f0efe..dcbc9dbce 100644 --- a/src/template_parser.rs +++ b/src/template_parser.rs @@ -14,13 +14,13 @@ extern crate pest; +use jujube_lib::commit::Commit; +use jujube_lib::repo::RepoRef; +use jujube_lib::store::{CommitId, Signature}; use pest::iterators::Pair; use pest::iterators::Pairs; use pest::Parser; -use jujube_lib::commit::Commit; -use jujube_lib::store::{CommitId, Signature}; - use crate::styler::PlainTextStyler; use crate::templater::{ AuthorProperty, ChangeIdProperty, CommitIdKeyword, CommitterProperty, ConditionalTemplate, @@ -29,7 +29,6 @@ use crate::templater::{ LiteralTemplate, ObsoleteProperty, OpenProperty, OrphanProperty, PrunedProperty, StringPropertyTemplate, Template, TemplateFunction, TemplateProperty, }; -use jujube_lib::repo::RepoRef; #[derive(Parser)] #[grammar = "template.pest"] diff --git a/src/ui.rs b/src/ui.rs index a85c0a4e6..2f63463d8 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -19,11 +19,11 @@ use std::path::{Path, PathBuf}; use std::sync::{Mutex, MutexGuard}; use jujube_lib::commit::Commit; +use jujube_lib::repo::RepoRef; use jujube_lib::settings::UserSettings; use crate::styler::{ColorStyler, PlainTextStyler, Styler}; use crate::templater::TemplateFormatter; -use jujube_lib::repo::RepoRef; pub struct Ui<'a> { cwd: PathBuf,