ok/jj
1
0
Fork 0
forked from mirrors/jj

rustfmt: configure to group imports

This commit is contained in:
Martin von Zweigbergk 2021-03-14 10:37:28 -07:00
parent ac9fb1832d
commit 4b8484e561
38 changed files with 98 additions and 84 deletions

View file

@ -14,9 +14,10 @@
extern crate protobuf_codegen_pure; extern crate protobuf_codegen_pure;
use protobuf_codegen_pure::Customize;
use std::path::Path; use std::path::Path;
use protobuf_codegen_pure::Customize;
fn main() { fn main() {
let out_dir = format!("{}/protos", std::env::var("OUT_DIR").unwrap()); let out_dir = format!("{}/protos", std::env::var("OUT_DIR").unwrap());

View file

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use std::sync::Arc;
use uuid::Uuid; use uuid::Uuid;
use crate::commit::Commit; use crate::commit::Commit;
@ -21,7 +23,6 @@ use crate::store;
use crate::store::{ChangeId, CommitId, Signature, Timestamp, TreeId}; use crate::store::{ChangeId, CommitId, Signature, Timestamp, TreeId};
use crate::store_wrapper::StoreWrapper; use crate::store_wrapper::StoreWrapper;
use crate::transaction::Transaction; use crate::transaction::Transaction;
use std::sync::Arc;
#[derive(Debug)] #[derive(Debug)]
pub struct CommitBuilder { pub struct CommitBuilder {

View file

@ -12,11 +12,12 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use std::io::{Cursor, Write};
use crate::files; use crate::files;
use crate::repo_path::RepoPath; use crate::repo_path::RepoPath;
use crate::store::{Conflict, TreeValue}; use crate::store::{Conflict, TreeValue};
use crate::store_wrapper::StoreWrapper; use crate::store_wrapper::StoreWrapper;
use std::io::{Cursor, Write};
pub fn materialize_conflict( pub fn materialize_conflict(
store: &StoreWrapper, store: &StoreWrapper,

View file

@ -13,11 +13,11 @@
// limitations under the License. // limitations under the License.
use std::collections::HashSet; use std::collections::HashSet;
use std::hash::Hash;
use std::iter::Iterator; use std::iter::Iterator;
use crate::commit::Commit; use crate::commit::Commit;
use crate::store::CommitId; use crate::store::CommitId;
use std::hash::Hash;
pub struct AncestorsIter { pub struct AncestorsIter {
bfs_iter: BfsIter<'static, 'static, Commit, CommitId, Vec<Commit>>, bfs_iter: BfsIter<'static, 'static, Commit, CommitId, Vec<Commit>>,

View file

@ -12,10 +12,11 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use diff::slice as diff_slice;
use std::fmt::{Debug, Error, Formatter}; use std::fmt::{Debug, Error, Formatter};
use std::ops::Range; use std::ops::Range;
use diff::slice as diff_slice;
fn is_word_byte(a: u8) -> bool { fn is_word_byte(a: u8) -> bool {
a.is_ascii_alphanumeric() || a == b'_' a.is_ascii_alphanumeric() || a == b'_'
} }

View file

@ -12,10 +12,11 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use thiserror::Error;
use crate::commit::Commit; use crate::commit::Commit;
use crate::store::CommitId; use crate::store::CommitId;
use crate::transaction::Transaction; use crate::transaction::Transaction;
use thiserror::Error;
#[derive(Error, Debug, PartialEq)] #[derive(Error, Debug, PartialEq)]
pub enum GitImportError { pub enum GitImportError {

View file

@ -15,21 +15,21 @@
use std::fmt::{Debug, Error, Formatter}; use std::fmt::{Debug, Error, Formatter};
use std::io::Cursor; use std::io::Cursor;
use std::io::Read; use std::io::Read;
use std::ops::Deref;
use std::path::Path; use std::path::Path;
use std::sync::Mutex; use std::sync::Mutex;
use std::time::Duration; use std::time::Duration;
use backoff::{ExponentialBackoff, Operation};
use git2::Oid; use git2::Oid;
use protobuf::Message; use protobuf::Message;
use uuid::Uuid;
use crate::repo_path::{DirRepoPath, FileRepoPath}; use crate::repo_path::{DirRepoPath, FileRepoPath};
use crate::store::{ use crate::store::{
ChangeId, Commit, CommitId, Conflict, ConflictId, ConflictPart, FileId, MillisSinceEpoch, ChangeId, Commit, CommitId, Conflict, ConflictId, ConflictPart, FileId, MillisSinceEpoch,
Signature, Store, StoreError, StoreResult, SymlinkId, Timestamp, Tree, TreeId, TreeValue, 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. /// Ref namespace used only for preventing GC.
const NO_GC_REF_NAMESPACE: &str = "refs/jj/keep/"; const NO_GC_REF_NAMESPACE: &str = "refs/jj/keep/";
@ -489,9 +489,8 @@ fn bytes_vec_from_json(value: &serde_json::Value) -> Vec<u8> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::store::{FileId, MillisSinceEpoch};
use super::*; use super::*;
use crate::store::{FileId, MillisSinceEpoch};
#[test] #[test]
fn read_plain_git_commit() { fn read_plain_git_commit() {

View file

@ -16,9 +16,11 @@ extern crate byteorder;
use std::cmp::{max, min, Ordering}; use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashSet}; use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashSet};
use std::fmt::{Debug, Formatter};
use std::fs::File; use std::fs::File;
use std::io; use std::io;
use std::io::{Cursor, Read, Write}; use std::io::{Cursor, Read, Write};
use std::ops::Bound;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::Arc; use std::sync::Arc;
@ -27,12 +29,8 @@ use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use tempfile::NamedTempFile; use tempfile::NamedTempFile;
use crate::commit::Commit; use crate::commit::Commit;
use crate::store::{ChangeId, CommitId}; use crate::store::{ChangeId, CommitId};
use std::fmt::{Debug, Formatter};
use std::ops::Bound;
#[derive(Clone)] #[derive(Clone)]
pub enum IndexRef<'a> { pub enum IndexRef<'a> {
Readonly(Arc<ReadonlyIndex>), Readonly(Arc<ReadonlyIndex>),
@ -1485,9 +1483,9 @@ impl ReadonlyIndex {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
use test_case::test_case; use test_case::test_case;
use super::*;
use crate::commit_builder::new_change_id; use crate::commit_builder::new_change_id;
#[test_case(false; "memory")] #[test_case(false; "memory")]

View file

@ -12,6 +12,15 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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::commit::Commit;
use crate::dag_walk; use crate::dag_walk;
use crate::index::{MutableIndex, ReadonlyIndex}; use crate::index::{MutableIndex, ReadonlyIndex};
@ -19,13 +28,6 @@ use crate::op_store::OperationId;
use crate::operation::Operation; use crate::operation::Operation;
use crate::store::CommitId; use crate::store::CommitId;
use crate::store_wrapper::StoreWrapper; 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 { pub struct IndexStore {
dir: PathBuf, dir: PathBuf,

View file

@ -12,11 +12,12 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use backoff::{ExponentialBackoff, Operation};
use std::fs::{File, OpenOptions}; use std::fs::{File, OpenOptions};
use std::path::PathBuf; use std::path::PathBuf;
use std::time::Duration; use std::time::Duration;
use backoff::{ExponentialBackoff, Operation};
pub struct FileLock { pub struct FileLock {
path: PathBuf, path: PathBuf,
_file: File, _file: File,

View file

@ -12,19 +12,20 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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::dag_walk;
use crate::lock::FileLock; use crate::lock::FileLock;
use crate::op_store; use crate::op_store;
use crate::op_store::{OpStore, OperationId, OperationMetadata}; use crate::op_store::{OpStore, OperationId, OperationMetadata};
use crate::operation::Operation; use crate::operation::Operation;
use crate::transaction::UnpublishedOperation;
use std::path::PathBuf;
use std::sync::Arc;
use crate::repo::RepoLoader; use crate::repo::RepoLoader;
use crate::store::{CommitId, Timestamp}; use crate::store::{CommitId, Timestamp};
use std::collections::HashSet; use crate::transaction::UnpublishedOperation;
use thiserror::Error;
/// Manages the very set of current heads of the operation log. The store is /// 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 /// simply a directory where each operation id is a file with that name (and no

View file

@ -12,10 +12,11 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use crate::store::{CommitId, Timestamp};
use std::collections::{BTreeMap, HashSet}; use std::collections::{BTreeMap, HashSet};
use std::fmt::{Debug, Error, Formatter}; use std::fmt::{Debug, Error, Formatter};
use crate::store::{CommitId, Timestamp};
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash)] #[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash)]
pub struct ViewId(pub Vec<u8>); pub struct ViewId(pub Vec<u8>);

View file

@ -12,15 +12,16 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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::cmp::Ordering;
use std::collections::HashSet; use std::collections::HashSet;
use std::fmt::{Debug, Error, Formatter}; use std::fmt::{Debug, Error, Formatter};
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::sync::Arc; use std::sync::Arc;
use crate::op_store;
use crate::op_store::{OpStore, OperationId, ViewId};
use crate::store::CommitId;
#[derive(Clone)] #[derive(Clone)]
pub struct Operation { pub struct Operation {
op_store: Arc<dyn OpStore>, op_store: Arc<dyn OpStore>,

View file

@ -19,11 +19,11 @@ use std::io::{Read, Write};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex, MutexGuard}; use std::sync::{Arc, Mutex, MutexGuard};
use crate::conflicts;
use thiserror::Error; use thiserror::Error;
use crate::commit::Commit; use crate::commit::Commit;
use crate::commit_builder::{new_change_id, signature, CommitBuilder}; use crate::commit_builder::{new_change_id, signature, CommitBuilder};
use crate::conflicts;
use crate::dag_walk::topo_order_reverse; use crate::dag_walk::topo_order_reverse;
use crate::evolution::{EvolutionRef, MutableEvolution, ReadonlyEvolution}; use crate::evolution::{EvolutionRef, MutableEvolution, ReadonlyEvolution};
use crate::git_store::GitStore; use crate::git_store::GitStore;

View file

@ -12,16 +12,17 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use std::borrow::Borrow;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::fmt::{Debug, Error, Formatter}; use std::fmt::{Debug, Error, Formatter};
use std::io::Read; use std::io::Read;
use std::result::Result; use std::result::Result;
use std::vec::Vec; use std::vec::Vec;
use thiserror::Error;
use crate::repo_path::DirRepoPath; use crate::repo_path::DirRepoPath;
use crate::repo_path::FileRepoPath; use crate::repo_path::FileRepoPath;
use std::borrow::Borrow;
use thiserror::Error;
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash)] #[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash)]
pub struct CommitId(pub Vec<u8>); pub struct CommitId(pub Vec<u8>);

View file

@ -13,6 +13,7 @@
// limitations under the License. // limitations under the License.
use std::collections::HashMap; use std::collections::HashMap;
use std::io::Read;
use std::sync::{Arc, RwLock, Weak}; use std::sync::{Arc, RwLock, Weak};
use crate::commit::Commit; use crate::commit::Commit;
@ -24,7 +25,6 @@ use crate::store::{
}; };
use crate::tree::Tree; use crate::tree::Tree;
use crate::tree_builder::TreeBuilder; use crate::tree_builder::TreeBuilder;
use std::io::Read;
/// Wraps the low-level store and makes it return more convenient types. Also /// Wraps the low-level store and makes it return more convenient types. Also
/// adds the root commit and adds caching. /// adds the root commit and adds caching.

View file

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use std::sync::Arc;
use crate::commit::Commit; use crate::commit::Commit;
use crate::evolution::MutableEvolution; use crate::evolution::MutableEvolution;
use crate::index::MutableIndex; use crate::index::MutableIndex;
@ -26,7 +28,6 @@ use crate::store;
use crate::store::{CommitId, Timestamp}; use crate::store::{CommitId, Timestamp};
use crate::store_wrapper::StoreWrapper; use crate::store_wrapper::StoreWrapper;
use crate::view::MutableView; use crate::view::MutableView;
use std::sync::Arc;
pub struct Transaction<'r> { pub struct Transaction<'r> {
repo: Option<Arc<MutableRepo<'r>>>, repo: Option<Arc<MutableRepo<'r>>>,

View file

@ -14,6 +14,7 @@
use std::borrow::Borrow; use std::borrow::Borrow;
use std::fmt::{Debug, Error, Formatter}; use std::fmt::{Debug, Error, Formatter};
use std::pin::Pin;
use std::sync::Arc; use std::sync::Arc;
use crate::matchers::AlwaysMatcher; use crate::matchers::AlwaysMatcher;
@ -24,7 +25,6 @@ use crate::store;
use crate::store::{ConflictId, TreeEntriesNonRecursiveIter, TreeEntry, TreeId, TreeValue}; use crate::store::{ConflictId, TreeEntriesNonRecursiveIter, TreeEntry, TreeId, TreeValue};
use crate::store_wrapper::StoreWrapper; use crate::store_wrapper::StoreWrapper;
use crate::trees::{recursive_tree_diff, TreeValueDiff}; use crate::trees::{recursive_tree_diff, TreeValueDiff};
use std::pin::Pin;
#[derive(Clone)] #[derive(Clone)]
pub struct Tree { pub struct Tree {

View file

@ -13,13 +13,13 @@
// limitations under the License. // limitations under the License.
use std::collections::{BTreeMap, HashSet}; use std::collections::{BTreeMap, HashSet};
use std::sync::Arc;
use crate::repo_path::{DirRepoPath, RepoPath, RepoPathJoin}; use crate::repo_path::{DirRepoPath, RepoPath, RepoPathJoin};
use crate::store; use crate::store;
use crate::store::{TreeId, TreeValue}; use crate::store::{TreeId, TreeValue};
use crate::store_wrapper::StoreWrapper; use crate::store_wrapper::StoreWrapper;
use crate::tree::Tree; use crate::tree::Tree;
use std::sync::Arc;
#[derive(Debug)] #[derive(Debug)]
enum Override { enum Override {

View file

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use std::cmp::Ordering;
use crate::files; use crate::files;
use crate::files::MergeResult; use crate::files::MergeResult;
use crate::matchers::Matcher; use crate::matchers::Matcher;
@ -21,7 +23,6 @@ use crate::repo_path::{
use crate::store::{Conflict, ConflictPart, StoreError, TreeId, TreeValue}; use crate::store::{Conflict, ConflictPart, StoreError, TreeId, TreeValue};
use crate::store_wrapper::StoreWrapper; use crate::store_wrapper::StoreWrapper;
use crate::tree::Tree; use crate::tree::Tree;
use std::cmp::Ordering;
#[derive(Debug, PartialEq, Eq, Clone)] #[derive(Debug, PartialEq, Eq, Clone)]
pub enum Diff<T> { pub enum Diff<T> {

View file

@ -18,7 +18,6 @@ use std::sync::Arc;
use crate::commit::Commit; use crate::commit::Commit;
use crate::op_store; use crate::op_store;
use crate::store::CommitId; use crate::store::CommitId;
use crate::store_wrapper::StoreWrapper; use crate::store_wrapper::StoreWrapper;

View file

@ -25,8 +25,10 @@ use std::os::unix::fs::PermissionsExt;
use std::os::windows::fs::symlink_file; use std::os::windows::fs::symlink_file;
use std::path::Path; use std::path::Path;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::Arc;
use std::time::UNIX_EPOCH; use std::time::UNIX_EPOCH;
use git2::{Repository, RepositoryInitOptions};
use protobuf::Message; use protobuf::Message;
use tempfile::NamedTempFile; use tempfile::NamedTempFile;
use thiserror::Error; use thiserror::Error;
@ -42,8 +44,6 @@ use crate::settings::UserSettings;
use crate::store::{CommitId, FileId, MillisSinceEpoch, StoreError, SymlinkId, TreeId, TreeValue}; use crate::store::{CommitId, FileId, MillisSinceEpoch, StoreError, SymlinkId, TreeId, TreeValue};
use crate::store_wrapper::StoreWrapper; use crate::store_wrapper::StoreWrapper;
use crate::trees::TreeValueDiff; use crate::trees::TreeValueDiff;
use git2::{Repository, RepositoryInitOptions};
use std::sync::Arc;
#[derive(Debug, PartialEq, Eq, Clone)] #[derive(Debug, PartialEq, Eq, Clone)]
pub enum FileType { pub enum FileType {

View file

@ -13,12 +13,11 @@
// limitations under the License. // limitations under the License.
use std::path::Path; use std::path::Path;
use std::sync::Arc;
use tempfile::TempDir;
use jujube_lib::repo::ReadonlyRepo; use jujube_lib::repo::ReadonlyRepo;
use jujube_lib::testutils; use jujube_lib::testutils;
use std::sync::Arc; use tempfile::TempDir;
use test_case::test_case; use test_case::test_case;
fn copy_directory(src: &Path, dst: &Path) { fn copy_directory(src: &Path, dst: &Path) {

View file

@ -12,12 +12,13 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use std::sync::Arc;
use jujube_lib::commit_builder::CommitBuilder; use jujube_lib::commit_builder::CommitBuilder;
use jujube_lib::repo_path::FileRepoPath; use jujube_lib::repo_path::FileRepoPath;
use jujube_lib::settings::UserSettings; use jujube_lib::settings::UserSettings;
use jujube_lib::testutils; use jujube_lib::testutils;
use jujube_lib::tree::DiffSummary; use jujube_lib::tree::DiffSummary;
use std::sync::Arc;
use test_case::test_case; use test_case::test_case;
#[test_case(false ; "local store")] #[test_case(false ; "local store")]

View file

@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use std::sync::Arc;
use std::thread; use std::thread;
use jujube_lib::dag_walk; use jujube_lib::dag_walk;
use jujube_lib::repo::ReadonlyRepo; use jujube_lib::repo::ReadonlyRepo;
use jujube_lib::testutils; use jujube_lib::testutils;
use std::sync::Arc;
use test_case::test_case; use test_case::test_case;
fn count_non_merge_operations(repo: &ReadonlyRepo) -> u32 { fn count_non_merge_operations(repo: &ReadonlyRepo) -> u32 {

View file

@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use std::collections::HashSet;
use std::path::PathBuf;
use std::sync::Arc;
use git2::Oid; use git2::Oid;
use jujube_lib::commit::Commit; use jujube_lib::commit::Commit;
use jujube_lib::git; use jujube_lib::git;
@ -21,9 +25,6 @@ use jujube_lib::settings::UserSettings;
use jujube_lib::store::CommitId; use jujube_lib::store::CommitId;
use jujube_lib::testutils; use jujube_lib::testutils;
use maplit::hashset; use maplit::hashset;
use std::collections::HashSet;
use std::path::PathBuf;
use std::sync::Arc;
use tempfile::TempDir; use tempfile::TempDir;
fn empty_git_commit<'r>( fn empty_git_commit<'r>(

View file

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use std::sync::Arc;
use jujube_lib::commit::Commit; use jujube_lib::commit::Commit;
use jujube_lib::commit_builder::CommitBuilder; use jujube_lib::commit_builder::CommitBuilder;
use jujube_lib::index::IndexRef; use jujube_lib::index::IndexRef;
@ -20,7 +22,6 @@ use jujube_lib::settings::UserSettings;
use jujube_lib::store::CommitId; use jujube_lib::store::CommitId;
use jujube_lib::testutils; use jujube_lib::testutils;
use jujube_lib::testutils::create_random_commit; use jujube_lib::testutils::create_random_commit;
use std::sync::Arc;
use test_case::test_case; use test_case::test_case;
#[must_use] #[must_use]

View file

@ -12,9 +12,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use std::sync::Arc;
use jujube_lib::repo::{ReadonlyRepo, RepoLoadError, RepoLoader}; use jujube_lib::repo::{ReadonlyRepo, RepoLoadError, RepoLoader};
use jujube_lib::testutils; use jujube_lib::testutils;
use std::sync::Arc;
use test_case::test_case; use test_case::test_case;
#[test] #[test]

View file

@ -12,12 +12,13 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use std::path::Path;
use std::sync::Arc;
use jujube_lib::commit_builder::CommitBuilder; use jujube_lib::commit_builder::CommitBuilder;
use jujube_lib::repo::RepoRef; use jujube_lib::repo::RepoRef;
use jujube_lib::store::CommitId; use jujube_lib::store::CommitId;
use jujube_lib::testutils; use jujube_lib::testutils;
use std::path::Path;
use std::sync::Arc;
use test_case::test_case; use test_case::test_case;
fn list_dir(dir: &Path) -> Vec<String> { fn list_dir(dir: &Path) -> Vec<String> {

View file

@ -12,12 +12,13 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use std::sync::Arc;
use jujube_lib::commit_builder::CommitBuilder; use jujube_lib::commit_builder::CommitBuilder;
use jujube_lib::repo_path::FileRepoPath; use jujube_lib::repo_path::FileRepoPath;
use jujube_lib::store::{Conflict, ConflictId, ConflictPart, TreeValue}; use jujube_lib::store::{Conflict, ConflictId, ConflictPart, TreeValue};
use jujube_lib::store_wrapper::StoreWrapper; use jujube_lib::store_wrapper::StoreWrapper;
use jujube_lib::testutils; use jujube_lib::testutils;
use std::sync::Arc;
use test_case::test_case; use test_case::test_case;
// TODO Many of the tests here are not run with Git because they end up creating // TODO Many of the tests here are not run with Git because they end up creating

View file

@ -12,8 +12,11 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use std::fs::OpenOptions;
use std::io::Write;
#[cfg(unix)] #[cfg(unix)]
use std::os::unix::fs::PermissionsExt; use std::os::unix::fs::PermissionsExt;
use std::sync::Arc;
use jujube_lib::commit_builder::CommitBuilder; use jujube_lib::commit_builder::CommitBuilder;
use jujube_lib::repo::ReadonlyRepo; use jujube_lib::repo::ReadonlyRepo;
@ -22,9 +25,6 @@ use jujube_lib::settings::UserSettings;
use jujube_lib::store::TreeValue; use jujube_lib::store::TreeValue;
use jujube_lib::testutils; use jujube_lib::testutils;
use jujube_lib::tree_builder::TreeBuilder; use jujube_lib::tree_builder::TreeBuilder;
use std::fs::OpenOptions;
use std::io::Write;
use std::sync::Arc;
use test_case::test_case; use test_case::test_case;
#[test_case(false ; "local store")] #[test_case(false ; "local store")]

View file

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use std::collections::HashSet;
use std::sync::Arc;
use std::thread; use std::thread;
use jujube_lib::commit_builder::CommitBuilder; use jujube_lib::commit_builder::CommitBuilder;
@ -20,8 +22,6 @@ use jujube_lib::repo_path::FileRepoPath;
use jujube_lib::store::CommitId; use jujube_lib::store::CommitId;
use jujube_lib::testutils; use jujube_lib::testutils;
use jujube_lib::working_copy::CheckoutError; use jujube_lib::working_copy::CheckoutError;
use std::collections::HashSet;
use std::sync::Arc;
use test_case::test_case; use test_case::test_case;
#[test_case(false ; "local store")] #[test_case(false ; "local store")]

View file

@ -1,3 +1,4 @@
max_width = 100 max_width = 100
wrap_comments = true wrap_comments = true
error_on_line_overflow = true error_on_line_overflow = true
group_imports = "StdExternalCrate"

View file

@ -18,19 +18,17 @@ extern crate config;
use std::collections::{HashSet, VecDeque}; use std::collections::{HashSet, VecDeque};
use std::ffi::OsString; use std::ffi::OsString;
use std::fmt::Debug;
use std::fs; use std::fs;
use std::fs::OpenOptions; use std::fs::OpenOptions;
use std::io; use std::io;
use std::io::{Read, Write}; use std::io::{Read, Write};
use std::process::Command; use std::process::Command;
use std::sync::Arc; use std::sync::Arc;
use std::time::Instant;
use clap::{crate_version, App, Arg, ArgMatches, SubCommand}; use clap::{crate_version, App, Arg, ArgMatches, SubCommand};
use criterion::Criterion; use criterion::Criterion;
use pest::Parser;
use jujube_lib::commit::Commit; use jujube_lib::commit::Commit;
use jujube_lib::commit_builder::CommitBuilder; use jujube_lib::commit_builder::CommitBuilder;
use jujube_lib::conflicts; use jujube_lib::conflicts;
@ -40,16 +38,23 @@ use jujube_lib::evolution::EvolveListener;
use jujube_lib::files; use jujube_lib::files;
use jujube_lib::files::DiffLine; use jujube_lib::files::DiffLine;
use jujube_lib::git; 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::op_store::{OpStore, OpStoreError, OperationId};
use jujube_lib::operation::Operation;
use jujube_lib::repo::{ReadonlyRepo, RepoLoadError, RepoLoader}; use jujube_lib::repo::{ReadonlyRepo, RepoLoadError, RepoLoader};
use jujube_lib::repo_path::RepoPath; use jujube_lib::repo_path::RepoPath;
use jujube_lib::rewrite::{back_out_commit, merge_commit_trees, rebase_commit}; use jujube_lib::rewrite::{back_out_commit, merge_commit_trees, rebase_commit};
use jujube_lib::settings::UserSettings; use jujube_lib::settings::UserSettings;
use jujube_lib::store::{CommitId, Timestamp}; use jujube_lib::store::{CommitId, Timestamp};
use jujube_lib::store::{StoreError, TreeValue}; 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::tree::Tree;
use jujube_lib::trees::TreeValueDiff; use jujube_lib::trees::TreeValueDiff;
use jujube_lib::view::merge_views;
use jujube_lib::working_copy::{CheckoutStats, WorkingCopy}; use jujube_lib::working_copy::{CheckoutStats, WorkingCopy};
use pest::Parser;
use self::chrono::{FixedOffset, TimeZone, Utc}; use self::chrono::{FixedOffset, TimeZone, Utc};
use crate::commands::CommandError::UserError; use crate::commands::CommandError::UserError;
@ -59,14 +64,6 @@ use crate::styler::{ColorStyler, Styler};
use crate::template_parser::TemplateParser; use crate::template_parser::TemplateParser;
use crate::templater::Template; use crate::templater::Template;
use crate::ui::Ui; 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 { enum CommandError {
UserError(String), UserError(String),

View file

@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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::repo_path::{DirRepoPath, RepoPath};
use jujube_lib::store::{StoreError, TreeId, TreeValue}; use jujube_lib::store::{StoreError, TreeId, TreeValue};
use jujube_lib::store_wrapper::StoreWrapper; use jujube_lib::store_wrapper::StoreWrapper;
@ -19,9 +23,6 @@ use jujube_lib::tree::Tree;
use jujube_lib::tree_builder::TreeBuilder; use jujube_lib::tree_builder::TreeBuilder;
use jujube_lib::trees::merge_trees; use jujube_lib::trees::merge_trees;
use jujube_lib::working_copy::{CheckoutError, TreeState}; use jujube_lib::working_copy::{CheckoutError, TreeState};
use std::path::{Path, PathBuf};
use std::process::Command;
use std::sync::Arc;
use tempfile::tempdir; use tempfile::tempdir;
use thiserror::Error; use thiserror::Error;

View file

@ -285,9 +285,10 @@ where
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
use indoc::indoc; use indoc::indoc;
use super::*;
#[test] #[test]
fn single_node() { fn single_node() {
let mut buffer = vec![]; let mut buffer = vec![];

View file

@ -14,13 +14,13 @@
extern crate pest; 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::Pair;
use pest::iterators::Pairs; use pest::iterators::Pairs;
use pest::Parser; use pest::Parser;
use jujube_lib::commit::Commit;
use jujube_lib::store::{CommitId, Signature};
use crate::styler::PlainTextStyler; use crate::styler::PlainTextStyler;
use crate::templater::{ use crate::templater::{
AuthorProperty, ChangeIdProperty, CommitIdKeyword, CommitterProperty, ConditionalTemplate, AuthorProperty, ChangeIdProperty, CommitIdKeyword, CommitterProperty, ConditionalTemplate,
@ -29,7 +29,6 @@ use crate::templater::{
LiteralTemplate, ObsoleteProperty, OpenProperty, OrphanProperty, PrunedProperty, LiteralTemplate, ObsoleteProperty, OpenProperty, OrphanProperty, PrunedProperty,
StringPropertyTemplate, Template, TemplateFunction, TemplateProperty, StringPropertyTemplate, Template, TemplateFunction, TemplateProperty,
}; };
use jujube_lib::repo::RepoRef;
#[derive(Parser)] #[derive(Parser)]
#[grammar = "template.pest"] #[grammar = "template.pest"]

View file

@ -19,11 +19,11 @@ use std::path::{Path, PathBuf};
use std::sync::{Mutex, MutexGuard}; use std::sync::{Mutex, MutexGuard};
use jujube_lib::commit::Commit; use jujube_lib::commit::Commit;
use jujube_lib::repo::RepoRef;
use jujube_lib::settings::UserSettings; use jujube_lib::settings::UserSettings;
use crate::styler::{ColorStyler, PlainTextStyler, Styler}; use crate::styler::{ColorStyler, PlainTextStyler, Styler};
use crate::templater::TemplateFormatter; use crate::templater::TemplateFormatter;
use jujube_lib::repo::RepoRef;
pub struct Ui<'a> { pub struct Ui<'a> {
cwd: PathBuf, cwd: PathBuf,