mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-21 15:22:05 +03:00
chore: align 'app' and 'lib' crates imports.
This is done one-time (for now) using a nightly feature of cargo-fmt as defined in `rustfmt-nightly.toml.` It's planned to make this the default so imports will always be sorted. For now it can be run manually with: cargo +nightly fmt -- --config-path rustfmt-nightly.toml or pnpm rustfmt
This commit is contained in:
parent
47e5badbfc
commit
603652e66b
@ -1,8 +1,7 @@
|
||||
use std::{fmt, str, sync::Arc};
|
||||
|
||||
use tauri::AppHandle;
|
||||
|
||||
use gitbutler::{projects::ProjectId, users::User};
|
||||
use tauri::AppHandle;
|
||||
|
||||
mod posthog;
|
||||
|
||||
|
@ -40,11 +40,9 @@ impl<T: super::Client + Sync> super::Client for Client<T> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
|
||||
|
||||
use super::super::Client;
|
||||
use super::{super::Client, *};
|
||||
|
||||
#[derive(Clone)]
|
||||
struct MockClient {
|
||||
|
@ -1,8 +1,6 @@
|
||||
use std::{collections::HashMap, path};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
|
||||
use crate::watcher;
|
||||
use gitbutler::{
|
||||
askpass::AskpassBroker,
|
||||
gb_repository, git,
|
||||
@ -14,6 +12,8 @@ use gitbutler::{
|
||||
virtual_branches::BranchId,
|
||||
};
|
||||
|
||||
use crate::watcher;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct App {
|
||||
local_data_dir: path::PathBuf,
|
||||
|
@ -1,16 +1,16 @@
|
||||
use std::{collections::HashMap, path};
|
||||
|
||||
use anyhow::Context;
|
||||
use tauri::Manager;
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::{app, watcher};
|
||||
use gitbutler::{
|
||||
error::{Code, Error},
|
||||
gb_repository, git, project_repository, projects, reader,
|
||||
sessions::SessionId,
|
||||
users,
|
||||
};
|
||||
use tauri::Manager;
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::{app, watcher};
|
||||
|
||||
impl From<app::Error> for Error {
|
||||
fn from(value: app::Error) -> Self {
|
||||
|
@ -1,13 +1,12 @@
|
||||
pub mod commands {
|
||||
use std::collections::HashMap;
|
||||
|
||||
use gitbutler::deltas::{controller::ListError, Controller, Delta};
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::error::{Code, Error};
|
||||
|
||||
use gitbutler::deltas::{controller::ListError, Controller, Delta};
|
||||
|
||||
impl From<ListError> for Error {
|
||||
fn from(value: ListError) -> Self {
|
||||
match value {
|
||||
|
@ -9,10 +9,12 @@ pub(crate) mod gb {
|
||||
|
||||
#[cfg(feature = "error-context")]
|
||||
mod error_context {
|
||||
use super::{ErrorKind, Result, WithContext};
|
||||
use backtrace::Backtrace;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use backtrace::Backtrace;
|
||||
|
||||
use super::{ErrorKind, Result, WithContext};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Context {
|
||||
pub backtrace: Backtrace,
|
||||
|
@ -1,9 +1,11 @@
|
||||
use crate::error::gb::{ErrorCode, ErrorContext};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use sentry::{
|
||||
protocol::{value::Map, Event, Exception, Value},
|
||||
types::Uuid,
|
||||
};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use crate::error::gb::{ErrorCode, ErrorContext};
|
||||
|
||||
pub trait SentrySender {
|
||||
fn send_to_sentry(self) -> Uuid;
|
||||
|
@ -1,6 +1,4 @@
|
||||
use anyhow::{Context, Result};
|
||||
use tauri::{AppHandle, Manager};
|
||||
|
||||
use gitbutler::{
|
||||
deltas,
|
||||
projects::ProjectId,
|
||||
@ -8,6 +6,7 @@ use gitbutler::{
|
||||
sessions::{self, SessionId},
|
||||
virtual_branches,
|
||||
};
|
||||
use tauri::{AppHandle, Manager};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Sender {
|
||||
|
@ -1,11 +1,10 @@
|
||||
pub mod commands {
|
||||
use gitbutler::keys::{controller, PublicKey};
|
||||
use tauri::Manager;
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::error::Error;
|
||||
|
||||
use gitbutler::keys::{controller, PublicKey};
|
||||
|
||||
impl From<controller::GetOrCreateError> for Error {
|
||||
fn from(value: controller::GetOrCreateError) -> Self {
|
||||
match value {
|
||||
|
@ -13,34 +13,17 @@
|
||||
clippy::too_many_lines
|
||||
)]
|
||||
|
||||
use gitbutler::assets;
|
||||
use gitbutler::database;
|
||||
use gitbutler::git;
|
||||
use gitbutler::storage;
|
||||
#[cfg(target_os = "windows")]
|
||||
use gitbutler::windows;
|
||||
use gitbutler_app::analytics;
|
||||
use gitbutler_app::app;
|
||||
use gitbutler_app::askpass;
|
||||
use gitbutler_app::commands;
|
||||
use gitbutler_app::deltas;
|
||||
use gitbutler_app::github;
|
||||
use gitbutler_app::keys;
|
||||
use gitbutler_app::logs;
|
||||
use gitbutler_app::menu;
|
||||
use gitbutler_app::projects;
|
||||
use gitbutler_app::sentry;
|
||||
use gitbutler_app::sessions;
|
||||
use gitbutler_app::users;
|
||||
use gitbutler_app::virtual_branches;
|
||||
use gitbutler_app::watcher;
|
||||
use gitbutler_app::zip;
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use anyhow::Context;
|
||||
#[cfg(target_os = "windows")]
|
||||
use gitbutler::windows;
|
||||
use gitbutler::{assets, database, git, storage};
|
||||
use gitbutler_app::{
|
||||
analytics, app, askpass, commands, deltas, github, keys, logs, menu, projects, sentry,
|
||||
sessions, users, virtual_branches, watcher, zip,
|
||||
};
|
||||
use tauri::{generate_context, Manager, Wry};
|
||||
|
||||
use tauri_plugin_log::LogTarget;
|
||||
use tauri_plugin_store::{with_store, JsonValue, StoreCollection};
|
||||
|
||||
|
@ -1,15 +1,14 @@
|
||||
pub mod commands {
|
||||
use std::path;
|
||||
|
||||
use tauri::Manager;
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::error::{Code, Error};
|
||||
|
||||
use gitbutler::projects::{
|
||||
self,
|
||||
controller::{self, Controller},
|
||||
};
|
||||
use tauri::Manager;
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::error::{Code, Error};
|
||||
|
||||
impl From<controller::UpdateError> for Error {
|
||||
fn from(value: controller::UpdateError) -> Self {
|
||||
|
@ -1,5 +1,6 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use gitbutler::users;
|
||||
use governor::{
|
||||
clock::QuantaClock,
|
||||
state::{InMemoryState, NotKeyed},
|
||||
@ -12,8 +13,6 @@ use sentry_tracing::SentryLayer;
|
||||
use tracing::Subscriber;
|
||||
use tracing_subscriber::registry::LookupSpan;
|
||||
|
||||
use gitbutler::users;
|
||||
|
||||
static SENTRY_QUOTA: Quota = Quota::per_second(nonzero!(1_u32)); // 1 per second at most.
|
||||
static SENTRY_LIMIT: OnceCell<RateLimiter<NotKeyed, InMemoryState, QuantaClock>> = OnceCell::new();
|
||||
|
||||
|
@ -1,14 +1,10 @@
|
||||
pub mod commands {
|
||||
use gitbutler::sessions::{controller::ListError, Controller, Session};
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::error::{Code, Error};
|
||||
|
||||
use gitbutler::sessions::{
|
||||
Session,
|
||||
{controller::ListError, Controller},
|
||||
};
|
||||
|
||||
impl From<ListError> for Error {
|
||||
fn from(value: ListError) -> Self {
|
||||
match value {
|
||||
|
@ -1,15 +1,16 @@
|
||||
pub mod commands {
|
||||
use gitbutler::{
|
||||
assets,
|
||||
users::{
|
||||
controller::{self, Controller, GetError},
|
||||
User,
|
||||
},
|
||||
};
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::{error::Error, sentry};
|
||||
|
||||
use gitbutler::{
|
||||
assets,
|
||||
users::controller::{self, Controller, GetError},
|
||||
users::User,
|
||||
};
|
||||
|
||||
impl From<GetError> for Error {
|
||||
fn from(value: GetError) -> Self {
|
||||
match value {
|
||||
|
@ -1,21 +1,21 @@
|
||||
pub mod commands {
|
||||
use anyhow::Context;
|
||||
use gitbutler::{
|
||||
askpass::AskpassBroker,
|
||||
assets,
|
||||
error::{Code, Error},
|
||||
git, projects,
|
||||
projects::ProjectId,
|
||||
virtual_branches::{
|
||||
branch::{self, BranchId, BranchOwnershipClaims},
|
||||
controller::{Controller, ControllerError},
|
||||
BaseBranch, RemoteBranch, RemoteBranchData, RemoteBranchFile, VirtualBranches,
|
||||
},
|
||||
};
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tracing::instrument;
|
||||
|
||||
use gitbutler::error::{Code, Error};
|
||||
|
||||
use crate::watcher;
|
||||
use gitbutler::askpass::AskpassBroker;
|
||||
use gitbutler::virtual_branches::{RemoteBranch, RemoteBranchData};
|
||||
use gitbutler::{
|
||||
assets, git, projects,
|
||||
projects::ProjectId,
|
||||
virtual_branches::branch::{self, BranchId, BranchOwnershipClaims},
|
||||
virtual_branches::controller::{Controller, ControllerError},
|
||||
virtual_branches::BaseBranch,
|
||||
virtual_branches::{RemoteBranchFile, VirtualBranches},
|
||||
};
|
||||
|
||||
fn into_error<E: Into<Error>>(value: ControllerError<E>) -> Error {
|
||||
match value {
|
||||
|
@ -4,9 +4,9 @@ pub mod handlers;
|
||||
|
||||
use std::{collections::HashMap, path, sync::Arc, time};
|
||||
|
||||
pub use events::Event;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
pub use events::Event;
|
||||
use gitbutler::projects::{self, Project, ProjectId};
|
||||
use tauri::AppHandle;
|
||||
use tokio::{
|
||||
sync::{
|
||||
@ -17,8 +17,6 @@ use tokio::{
|
||||
};
|
||||
use tokio_util::sync::CancellationToken;
|
||||
|
||||
use gitbutler::projects::{self, Project, ProjectId};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Watchers {
|
||||
app_handle: AppHandle,
|
||||
|
@ -3,6 +3,7 @@ mod file_change;
|
||||
use std::path;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use gitbutler::projects::ProjectId;
|
||||
use tokio::{
|
||||
select,
|
||||
sync::mpsc::{channel, Receiver},
|
||||
@ -10,8 +11,6 @@ use tokio::{
|
||||
};
|
||||
use tokio_util::sync::CancellationToken;
|
||||
|
||||
use gitbutler::projects::ProjectId;
|
||||
|
||||
use super::events;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -6,6 +6,7 @@ use std::{
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use futures::executor::block_on;
|
||||
use gitbutler::{git, projects::ProjectId};
|
||||
use notify::{RecommendedWatcher, Watcher};
|
||||
use notify_debouncer_full::{new_debouncer, Debouncer, FileIdMap};
|
||||
use tokio::{
|
||||
@ -14,7 +15,6 @@ use tokio::{
|
||||
};
|
||||
|
||||
use crate::watcher::events;
|
||||
use gitbutler::{git, projects::ProjectId};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Dispatcher {
|
||||
|
@ -15,9 +15,8 @@ use anyhow::{Context, Result};
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::events as app_events;
|
||||
|
||||
use super::events;
|
||||
use crate::events as app_events;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Handler {
|
||||
|
@ -1,10 +1,9 @@
|
||||
use anyhow::{Context, Result};
|
||||
use gitbutler::users;
|
||||
use tauri::{AppHandle, Manager};
|
||||
|
||||
use crate::analytics;
|
||||
use gitbutler::users;
|
||||
|
||||
use super::events;
|
||||
use crate::analytics;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Handler {
|
||||
|
@ -1,13 +1,12 @@
|
||||
use std::{path, vec};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use tauri::{AppHandle, Manager};
|
||||
|
||||
use gitbutler::{
|
||||
deltas, gb_repository, project_repository,
|
||||
projects::{self, ProjectId},
|
||||
reader, sessions, users,
|
||||
};
|
||||
use tauri::{AppHandle, Manager};
|
||||
|
||||
use super::events;
|
||||
|
||||
|
@ -1,6 +1,11 @@
|
||||
use std::{sync::Arc, time::Duration};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use gitbutler::{
|
||||
assets,
|
||||
projects::ProjectId,
|
||||
virtual_branches::{self, controller::ControllerError, VirtualBranches},
|
||||
};
|
||||
use governor::{
|
||||
clock::QuantaClock,
|
||||
state::{InMemoryState, NotKeyed},
|
||||
@ -9,14 +14,8 @@ use governor::{
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use crate::events as app_events;
|
||||
use gitbutler::{
|
||||
assets,
|
||||
projects::ProjectId,
|
||||
virtual_branches::{self, controller::ControllerError, VirtualBranches},
|
||||
};
|
||||
|
||||
use super::events;
|
||||
use crate::events as app_events;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Handler {
|
||||
|
@ -1,11 +1,10 @@
|
||||
use std::{path, sync::Arc, time};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use gitbutler::{gb_repository, project_repository, projects, projects::ProjectId, users};
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use gitbutler::{gb_repository, project_repository, projects, projects::ProjectId, users};
|
||||
|
||||
use super::events;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,7 +1,10 @@
|
||||
use std::vec;
|
||||
use std::{sync::Arc, time::Duration};
|
||||
use std::{sync::Arc, time::Duration, vec};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use gitbutler::{
|
||||
project_repository,
|
||||
projects::{self, ProjectId},
|
||||
};
|
||||
use governor::{
|
||||
clock::QuantaClock,
|
||||
state::{InMemoryState, NotKeyed},
|
||||
@ -10,11 +13,6 @@ use governor::{
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use gitbutler::{
|
||||
project_repository,
|
||||
projects::{self, ProjectId},
|
||||
};
|
||||
|
||||
use super::events;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,12 +1,11 @@
|
||||
use std::{path, sync::Arc};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use gitbutler::{
|
||||
gb_repository, project_repository, projects, projects::ProjectId, sessions, users,
|
||||
};
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use super::events;
|
||||
|
||||
|
@ -1,16 +1,15 @@
|
||||
use std::path;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use tauri::{AppHandle, Manager};
|
||||
|
||||
use crate::{analytics, events as app_events};
|
||||
use gitbutler::{
|
||||
gb_repository, git, project_repository,
|
||||
projects::{self, ProjectId},
|
||||
users,
|
||||
};
|
||||
use tauri::{AppHandle, Manager};
|
||||
|
||||
use super::events;
|
||||
use crate::{analytics, events as app_events};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Handler {
|
||||
|
@ -1,17 +1,16 @@
|
||||
use std::path;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use tauri::{AppHandle, Manager};
|
||||
|
||||
use crate::events as app_events;
|
||||
use gitbutler::{
|
||||
deltas, gb_repository, project_repository,
|
||||
projects::{self, ProjectId},
|
||||
sessions::{self, SessionId},
|
||||
users,
|
||||
};
|
||||
use tauri::{AppHandle, Manager};
|
||||
|
||||
use super::events;
|
||||
use crate::events as app_events;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Handler {
|
||||
|
@ -1,13 +1,15 @@
|
||||
use std::path;
|
||||
use std::sync::{Arc, Mutex, TryLockError};
|
||||
use std::{
|
||||
path,
|
||||
sync::{Arc, Mutex, TryLockError},
|
||||
};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use gitbutler::{
|
||||
gb_repository, gb_repository::RemoteError, project_repository, projects, projects::ProjectId,
|
||||
users,
|
||||
};
|
||||
use tauri::{AppHandle, Manager};
|
||||
|
||||
use gitbutler::gb_repository::RemoteError;
|
||||
use gitbutler::projects::ProjectId;
|
||||
use gitbutler::{gb_repository, project_repository, projects, users};
|
||||
|
||||
use super::events;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,10 +1,6 @@
|
||||
use std::{path, sync::Arc, time};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use itertools::Itertools;
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use gitbutler::{
|
||||
gb_repository,
|
||||
git::{self, Oid, Repository},
|
||||
@ -12,6 +8,9 @@ use gitbutler::{
|
||||
projects::{self, CodePushState, ProjectId},
|
||||
users,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use super::events;
|
||||
|
||||
|
@ -2,13 +2,12 @@ pub mod commands {
|
||||
#![allow(clippy::used_underscore_binding)]
|
||||
use std::path;
|
||||
|
||||
use gitbutler::zip::controller;
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::error::{Code, Error};
|
||||
|
||||
use gitbutler::zip::controller;
|
||||
|
||||
impl From<controller::ArchiveError> for Error {
|
||||
fn from(error: controller::ArchiveError) -> Self {
|
||||
match error {
|
||||
|
@ -1,21 +1,20 @@
|
||||
use anyhow::Result;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
path::{Path, PathBuf},
|
||||
sync::atomic::{AtomicUsize, Ordering},
|
||||
};
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
use crate::shared::{commit_all, Case, Suite};
|
||||
use anyhow::Result;
|
||||
use gitbutler::{
|
||||
deltas::{self, operations::Operation},
|
||||
reader, sessions,
|
||||
virtual_branches::{self, branch},
|
||||
};
|
||||
use gitbutler_app::watcher::handlers::calculate_deltas_handler::Handler;
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
use self::branch::BranchId;
|
||||
use crate::shared::{commit_all, Case, Suite};
|
||||
|
||||
static TEST_TARGET_INDEX: Lazy<AtomicUsize> = Lazy::new(|| AtomicUsize::new(0));
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
use std::time::SystemTime;
|
||||
|
||||
use gitbutler::projects;
|
||||
use gitbutler_app::watcher::handlers::fetch_gitbutler_data::Handler;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use crate::shared::{Case, Suite};
|
||||
use crate::watcher::handler::test_remote_repository;
|
||||
use gitbutler_app::watcher::handlers::fetch_gitbutler_data::Handler;
|
||||
use crate::{
|
||||
shared::{Case, Suite},
|
||||
watcher::handler::test_remote_repository,
|
||||
};
|
||||
|
||||
#[tokio::test]
|
||||
async fn fetch_success() -> anyhow::Result<()> {
|
||||
|
@ -1,12 +1,11 @@
|
||||
use anyhow::Result;
|
||||
use std::fs;
|
||||
|
||||
use anyhow::Result;
|
||||
use gitbutler::projects;
|
||||
use gitbutler_app::watcher::{handlers, handlers::git_file_change::Handler, Event};
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use crate::shared::{Case, Suite};
|
||||
use gitbutler_app::watcher::handlers::git_file_change::Handler;
|
||||
use gitbutler_app::watcher::{handlers, Event};
|
||||
|
||||
#[test]
|
||||
fn flush_session() -> Result<()> {
|
||||
|
@ -1,6 +1,7 @@
|
||||
use crate::shared::init_opts_bare;
|
||||
use tempfile::TempDir;
|
||||
|
||||
use crate::shared::init_opts_bare;
|
||||
|
||||
fn test_remote_repository() -> anyhow::Result<(git2::Repository, TempDir)> {
|
||||
let tmp = tempfile::tempdir()?;
|
||||
let repo_a = git2::Repository::init_opts(&tmp, &init_opts_bare())?;
|
||||
|
@ -1,14 +1,14 @@
|
||||
use anyhow::Result;
|
||||
use gitbutler::{git, projects};
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
use std::{collections::HashMap, path::PathBuf};
|
||||
|
||||
use crate::shared::virtual_branches::set_test_target;
|
||||
use crate::shared::{Case, Suite};
|
||||
use crate::watcher::handler::test_remote_repository;
|
||||
use gitbutler::project_repository::LogUntil;
|
||||
use anyhow::Result;
|
||||
use gitbutler::{git, project_repository::LogUntil, projects};
|
||||
use gitbutler_app::watcher::handlers::push_project_to_gitbutler::Handler;
|
||||
|
||||
use crate::{
|
||||
shared::{virtual_branches::set_test_target, Case, Suite},
|
||||
watcher::handler::test_remote_repository,
|
||||
};
|
||||
|
||||
fn log_walk(repo: &git2::Repository, head: git::Oid) -> Vec<git::Oid> {
|
||||
let mut walker = repo.revwalk().unwrap();
|
||||
walker.push(head.into()).unwrap();
|
||||
|
@ -12,7 +12,8 @@
|
||||
"lint": "pnpm --filter @gitbutler/ui run lint",
|
||||
"format": "pnpm --filter @gitbutler/ui run format",
|
||||
"tauri": "tauri",
|
||||
"prepare": "pnpm --filter @gitbutler/ui run prepare"
|
||||
"prepare": "pnpm --filter @gitbutler/ui run prepare",
|
||||
"rustfmt": "cargo +nightly fmt -- --config-path rustfmt-nightly.toml"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^1.5.11"
|
||||
|
4
rustfmt-nightly.toml
Normal file
4
rustfmt-nightly.toml
Normal file
@ -0,0 +1,4 @@
|
||||
group_imports = "StdExternalCrate"
|
||||
imports_granularity = "Crate"
|
||||
# This is useful to adapt to larger screens of today, for better use of horizontal screen space.
|
||||
# max_width = 120
|
@ -3,8 +3,7 @@ use std::{collections::HashMap, sync::Arc};
|
||||
use serde::Serialize;
|
||||
use tokio::sync::{oneshot, Mutex};
|
||||
|
||||
use crate::id::Id;
|
||||
use crate::virtual_branches::BranchId;
|
||||
use crate::{id::Id, virtual_branches::BranchId};
|
||||
|
||||
pub struct AskpassRequest {
|
||||
sender: oneshot::Sender<Option<String>>,
|
||||
|
@ -1,7 +1,6 @@
|
||||
use std::{path, sync::Arc};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
|
||||
use r2d2::Pool;
|
||||
use r2d2_sqlite::SqliteConnectionManager;
|
||||
use refinery::config::Config;
|
||||
|
@ -1,8 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::{projects::ProjectId, sessions::SessionId};
|
||||
|
||||
use super::{database, Delta};
|
||||
use crate::{projects::ProjectId, sessions::SessionId};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Controller {
|
||||
|
@ -2,9 +2,8 @@ use std::{collections::HashMap, path};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
|
||||
use crate::{database, projects::ProjectId, sessions::SessionId};
|
||||
|
||||
use super::{delta, operations};
|
||||
use crate::{database, projects::ProjectId, sessions::SessionId};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Database {
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::operations;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::operations;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Delta {
|
||||
|
@ -1,12 +1,13 @@
|
||||
use crate::reader;
|
||||
|
||||
use super::{delta, operations};
|
||||
use anyhow::Result;
|
||||
use std::{
|
||||
fmt::{Display, Formatter},
|
||||
time::SystemTime,
|
||||
};
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
use super::{delta, operations};
|
||||
use crate::reader;
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct Document {
|
||||
doc: Vec<char>,
|
||||
|
@ -2,9 +2,8 @@ use std::{collections::HashMap, path};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
|
||||
use crate::{reader, sessions};
|
||||
|
||||
use super::Delta;
|
||||
use crate::{reader, sessions};
|
||||
|
||||
pub struct DeltasReader<'reader> {
|
||||
reader: &'reader reader::Reader<'reader>,
|
||||
|
@ -2,9 +2,8 @@ use std::path::PathBuf;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
use crate::{gb_repository, writer};
|
||||
|
||||
use super::Delta;
|
||||
use crate::{gb_repository, writer};
|
||||
|
||||
pub struct DeltasWriter<'writer> {
|
||||
repository: &'writer gb_repository::Repository,
|
||||
|
@ -9,10 +9,12 @@ pub mod gb {
|
||||
|
||||
#[cfg(feature = "error-context")]
|
||||
mod error_context {
|
||||
use super::{ErrorKind, Result, WithContext};
|
||||
use backtrace::Backtrace;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use backtrace::Backtrace;
|
||||
|
||||
use super::{ErrorKind, Result, WithContext};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Context {
|
||||
pub backtrace: Backtrace,
|
||||
@ -319,9 +321,10 @@ pub mod gb {
|
||||
mod legacy {
|
||||
use core::fmt;
|
||||
|
||||
use crate::{keys, projects, users};
|
||||
use serde::{ser::SerializeMap, Serialize};
|
||||
|
||||
use crate::{keys, projects, users};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Code {
|
||||
Unknown,
|
||||
|
@ -1,9 +1,11 @@
|
||||
use crate::error::gb::{ErrorCode, ErrorContext};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use sentry::{
|
||||
protocol::{value::Map, Event, Exception, Value},
|
||||
types::Uuid,
|
||||
};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use crate::error::gb::{ErrorCode, ErrorContext};
|
||||
|
||||
pub trait SentrySender {
|
||||
fn send_to_sentry(self) -> Uuid;
|
||||
|
@ -1,3 +1,5 @@
|
||||
#[cfg(target_family = "unix")]
|
||||
use std::os::unix::prelude::*;
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
fs::File,
|
||||
@ -5,16 +7,13 @@ use std::{
|
||||
path, time,
|
||||
};
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
use crate::windows::MetadataShim;
|
||||
#[cfg(target_family = "unix")]
|
||||
use std::os::unix::prelude::*;
|
||||
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use filetime::FileTime;
|
||||
use fslock::LockFile;
|
||||
use sha2::{Digest, Sha256};
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
use crate::windows::MetadataShim;
|
||||
use crate::{
|
||||
deltas, fs, git, project_repository,
|
||||
projects::{self, ProjectId},
|
||||
|
@ -3,9 +3,8 @@ use std::{collections::HashMap, path, str};
|
||||
use anyhow::{Context, Result};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::git;
|
||||
|
||||
use super::Repository;
|
||||
use crate::git;
|
||||
|
||||
/// The type of change
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
@ -5,12 +5,11 @@ mod r#virtual;
|
||||
|
||||
use std::{fmt, str::FromStr};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub use error::Error;
|
||||
pub use local::Refname as LocalRefname;
|
||||
pub use r#virtual::Refname as VirtualRefname;
|
||||
pub use remote::Refname as RemoteRefname;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::git;
|
||||
|
||||
|
@ -2,9 +2,8 @@ use std::{fmt, str::FromStr};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::git;
|
||||
|
||||
use super::{error::Error, remote};
|
||||
use crate::git;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct Refname {
|
||||
|
@ -2,9 +2,8 @@ use std::{fmt, str::FromStr};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::git;
|
||||
|
||||
use super::error::Error;
|
||||
use crate::git;
|
||||
|
||||
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct Refname {
|
||||
|
@ -2,10 +2,8 @@ use std::{fmt, str::FromStr};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::virtual_branches::normalize_branch_name;
|
||||
use crate::virtual_branches::Branch;
|
||||
|
||||
use super::error::Error;
|
||||
use crate::virtual_branches::{normalize_branch_name, Branch};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct Refname {
|
||||
|
@ -3,12 +3,11 @@ use std::{io::Write, path::Path, str};
|
||||
use git2::Submodule;
|
||||
use git2_hooks::HookResult;
|
||||
|
||||
use crate::{keys, path::Normalize};
|
||||
|
||||
use super::{
|
||||
Blob, Branch, Commit, Config, Index, Oid, Reference, Refname, Remote, Result, Signature, Tree,
|
||||
TreeBuilder, Url,
|
||||
};
|
||||
use crate::{keys, path::Normalize};
|
||||
|
||||
// wrapper around git2::Repository to get control over how it's used.
|
||||
pub struct Repository(git2::Repository);
|
||||
|
@ -1,8 +1,7 @@
|
||||
use super::Repository;
|
||||
use crate::git;
|
||||
use std::{path, str};
|
||||
|
||||
use super::Result;
|
||||
use super::{Repository, Result};
|
||||
use crate::git;
|
||||
|
||||
pub fn show_file_at_tree<P: AsRef<path::Path>>(
|
||||
repository: &Repository,
|
||||
|
@ -1,9 +1,8 @@
|
||||
use std::{fmt, str::FromStr};
|
||||
|
||||
use ssh_key::{HashAlg, LineEnding, SshSig};
|
||||
|
||||
use rand::rngs::OsRng;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ssh_key::{HashAlg, LineEnding, SshSig};
|
||||
|
||||
#[derive(Debug, Clone, Eq)]
|
||||
pub struct PrivateKey(ssh_key::PrivateKey);
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::storage;
|
||||
|
||||
use super::PrivateKey;
|
||||
use crate::storage;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Storage {
|
||||
|
@ -13,9 +13,8 @@ use std::{
|
||||
use anyhow::Result;
|
||||
use itertools::Itertools;
|
||||
|
||||
use crate::git;
|
||||
|
||||
use super::Repository;
|
||||
use crate::git;
|
||||
|
||||
pub fn mark<P: AsRef<Path>, A: AsRef<[P]>>(
|
||||
repository: &Repository,
|
||||
|
@ -6,6 +6,7 @@ use std::{
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
|
||||
use super::conflicts;
|
||||
use crate::{
|
||||
askpass,
|
||||
askpass::AskpassBroker,
|
||||
@ -16,8 +17,6 @@ use crate::{
|
||||
virtual_branches::{Branch, BranchId},
|
||||
};
|
||||
|
||||
use super::conflicts;
|
||||
|
||||
pub struct Repository {
|
||||
pub git_repository: git::Repository,
|
||||
project: projects::Project,
|
||||
|
@ -3,7 +3,5 @@ mod project;
|
||||
pub mod storage;
|
||||
|
||||
pub use controller::*;
|
||||
pub use project::{AuthKey, CodePushState, FetchResult, Project, ProjectId};
|
||||
pub use project::{ApiProject, AuthKey, CodePushState, FetchResult, Project, ProjectId};
|
||||
pub use storage::UpdateRequest;
|
||||
|
||||
pub use project::ApiProject;
|
||||
|
@ -1,9 +1,13 @@
|
||||
use super::{storage, storage::UpdateRequest, Project, ProjectId};
|
||||
use crate::{gb_repository, project_repository, users};
|
||||
use std::{
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use anyhow::Context;
|
||||
use async_trait::async_trait;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::{storage, storage::UpdateRequest, Project, ProjectId};
|
||||
use crate::{gb_repository, project_repository, users};
|
||||
|
||||
#[async_trait]
|
||||
pub trait Watchers {
|
||||
|
@ -2,14 +2,13 @@ use std::path;
|
||||
|
||||
use anyhow::Context;
|
||||
|
||||
use super::{Database, Session};
|
||||
use crate::{
|
||||
gb_repository, project_repository,
|
||||
projects::{self, ProjectId},
|
||||
users,
|
||||
};
|
||||
|
||||
use super::{Database, Session};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Controller {
|
||||
local_data_dir: path::PathBuf,
|
||||
|
@ -1,8 +1,7 @@
|
||||
use anyhow::{Context, Result};
|
||||
|
||||
use crate::{database, projects::ProjectId};
|
||||
|
||||
use super::session::{self, SessionId};
|
||||
use crate::{database, projects::ProjectId};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Database {
|
||||
|
@ -1,8 +1,7 @@
|
||||
use anyhow::{Context, Result};
|
||||
|
||||
use crate::{git, reader};
|
||||
|
||||
use super::{Session, SessionError};
|
||||
use crate::{git, reader};
|
||||
|
||||
pub struct SessionsIterator<'iterator> {
|
||||
git_repository: &'iterator git::Repository,
|
||||
|
@ -2,9 +2,8 @@ use std::{collections::HashMap, path};
|
||||
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
|
||||
use crate::{gb_repository, reader};
|
||||
|
||||
use super::Session;
|
||||
use crate::{gb_repository, reader};
|
||||
|
||||
pub struct SessionReader<'reader> {
|
||||
// reader for the current session. commit or wd
|
||||
|
@ -2,9 +2,8 @@ use std::time;
|
||||
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
|
||||
use crate::{gb_repository, reader, writer};
|
||||
|
||||
use super::Session;
|
||||
use crate::{gb_repository, reader, writer};
|
||||
|
||||
pub struct SessionWriter<'writer> {
|
||||
repository: &'writer gb_repository::Repository,
|
||||
|
@ -1,12 +1,11 @@
|
||||
#[cfg(target_family = "unix")]
|
||||
use std::os::unix::prelude::*;
|
||||
use std::{
|
||||
fs,
|
||||
path::{Path, PathBuf},
|
||||
sync::{Arc, RwLock},
|
||||
};
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
use std::os::unix::prelude::*;
|
||||
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct Storage {
|
||||
local_data_dir: Arc<RwLock<PathBuf>>,
|
||||
|
@ -3,6 +3,11 @@ use std::time;
|
||||
use anyhow::{Context, Result};
|
||||
use serde::Serialize;
|
||||
|
||||
use super::{
|
||||
branch, errors,
|
||||
integration::{update_gitbutler_integration, GITBUTLER_INTEGRATION_REFERENCE},
|
||||
target, BranchId, RemoteCommit,
|
||||
};
|
||||
use crate::{
|
||||
gb_repository,
|
||||
git::{self, diff},
|
||||
@ -13,12 +18,6 @@ use crate::{
|
||||
virtual_branches::branch::BranchOwnershipClaims,
|
||||
};
|
||||
|
||||
use super::{
|
||||
branch, errors,
|
||||
integration::{update_gitbutler_integration, GITBUTLER_INTEGRATION_REFERENCE},
|
||||
target, BranchId, RemoteCommit,
|
||||
};
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct BaseBranch {
|
||||
|
@ -4,16 +4,13 @@ mod ownership;
|
||||
mod reader;
|
||||
mod writer;
|
||||
|
||||
use anyhow::Result;
|
||||
pub use file_ownership::OwnershipClaim;
|
||||
pub use hunk::Hunk;
|
||||
pub use ownership::reconcile_claims;
|
||||
pub use ownership::BranchOwnershipClaims;
|
||||
pub use ownership::{reconcile_claims, BranchOwnershipClaims};
|
||||
pub use reader::BranchReader as Reader;
|
||||
pub use writer::BranchWriter as Writer;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use anyhow::Result;
|
||||
pub use writer::BranchWriter as Writer;
|
||||
|
||||
use crate::{git, id::Id};
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
use std::{collections::HashSet, fmt, str::FromStr};
|
||||
|
||||
use anyhow::Result;
|
||||
use itertools::Itertools;
|
||||
use serde::{Deserialize, Serialize, Serializer};
|
||||
|
||||
use super::{Branch, OwnershipClaim};
|
||||
use anyhow::Result;
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq)]
|
||||
pub struct BranchOwnershipClaims {
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::{reader, sessions};
|
||||
|
||||
use super::{Branch, BranchId};
|
||||
use crate::{reader, sessions};
|
||||
|
||||
pub struct BranchReader<'r> {
|
||||
reader: &'r reader::Reader<'r>,
|
||||
|
@ -2,9 +2,8 @@ use std::path;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
use crate::{gb_repository, reader, virtual_branches::state::VirtualBranchesHandle, writer};
|
||||
|
||||
use super::Branch;
|
||||
use crate::{gb_repository, reader, virtual_branches::state::VirtualBranchesHandle, writer};
|
||||
|
||||
pub struct BranchWriter<'writer> {
|
||||
repository: &'writer gb_repository::Repository,
|
||||
|
@ -3,15 +3,6 @@ use std::{collections::HashMap, path, sync::Arc};
|
||||
use anyhow::Context;
|
||||
use tokio::{sync::Semaphore, task::JoinHandle};
|
||||
|
||||
use crate::{
|
||||
askpass::AskpassBroker,
|
||||
error::Error,
|
||||
gb_repository, git, keys, project_repository,
|
||||
projects::{self, ProjectId},
|
||||
users,
|
||||
virtual_branches::state::{VirtualBranches, VirtualBranchesHandle},
|
||||
};
|
||||
|
||||
use super::{
|
||||
branch::{BranchId, BranchOwnershipClaims},
|
||||
errors::{
|
||||
@ -20,6 +11,14 @@ use super::{
|
||||
},
|
||||
target_to_base_branch, BaseBranch, RemoteBranchFile,
|
||||
};
|
||||
use crate::{
|
||||
askpass::AskpassBroker,
|
||||
error::Error,
|
||||
gb_repository, git, keys, project_repository,
|
||||
projects::{self, ProjectId},
|
||||
users,
|
||||
virtual_branches::state::{VirtualBranches, VirtualBranchesHandle},
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Controller {
|
||||
|
@ -1,3 +1,4 @@
|
||||
use super::{branch::BranchOwnershipClaims, BranchId, GITBUTLER_INTEGRATION_REFERENCE};
|
||||
use crate::{
|
||||
error::Error,
|
||||
git,
|
||||
@ -5,8 +6,6 @@ use crate::{
|
||||
projects::ProjectId,
|
||||
};
|
||||
|
||||
use super::{branch::BranchOwnershipClaims, BranchId, GITBUTLER_INTEGRATION_REFERENCE};
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum VerifyError {
|
||||
#[error("head is detached")]
|
||||
|
@ -3,10 +3,11 @@ use std::path;
|
||||
use anyhow::{Context, Result};
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::git::{self, diff, show};
|
||||
|
||||
use super::errors;
|
||||
use crate::virtual_branches::context;
|
||||
use crate::{
|
||||
git::{self, diff, show},
|
||||
virtual_branches::context,
|
||||
};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
|
@ -3,6 +3,7 @@ use std::io::{Read, Write};
|
||||
use anyhow::{Context, Result};
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
use super::errors;
|
||||
use crate::{
|
||||
gb_repository,
|
||||
git::{self},
|
||||
@ -11,8 +12,6 @@ use crate::{
|
||||
virtual_branches::branch::BranchCreateRequest,
|
||||
};
|
||||
|
||||
use super::errors;
|
||||
|
||||
lazy_static! {
|
||||
pub static ref GITBUTLER_INTEGRATION_REFERENCE: git::LocalRefname =
|
||||
git::LocalRefname::new("gitbutler/integration", None);
|
||||
|
@ -2,9 +2,8 @@ use std::collections::HashSet;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
use crate::sessions;
|
||||
|
||||
use super::branch::{self, BranchId};
|
||||
use crate::sessions;
|
||||
|
||||
pub struct BranchIterator<'i> {
|
||||
branch_reader: branch::Reader<'i>,
|
||||
|
@ -1,13 +1,12 @@
|
||||
use anyhow::{Context, Result};
|
||||
use serde::Serialize;
|
||||
|
||||
use super::{errors, Author};
|
||||
use crate::{
|
||||
gb_repository, git,
|
||||
project_repository::{self, LogUntil},
|
||||
};
|
||||
|
||||
use super::{errors, Author};
|
||||
|
||||
// this struct is a mapping to the view `RemoteBranch` type in Typescript
|
||||
// found in src-tauri/src/routes/repo/[project_id]/types.ts
|
||||
//
|
||||
|
@ -8,9 +8,8 @@ use std::{
|
||||
use anyhow::Result;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::virtual_branches::BranchId;
|
||||
|
||||
use super::{target::Target, Branch};
|
||||
use crate::virtual_branches::BranchId;
|
||||
|
||||
/// The state of virtual branches data, as persisted in a TOML file.
|
||||
#[derive(Serialize, Deserialize, Debug, Default)]
|
||||
|
@ -3,10 +3,8 @@ mod writer;
|
||||
|
||||
use std::str::FromStr;
|
||||
|
||||
use serde::{ser::SerializeStruct, Deserializer, Serializer};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub use reader::TargetReader as Reader;
|
||||
use serde::{ser::SerializeStruct, Deserialize, Deserializer, Serialize, Serializer};
|
||||
pub use writer::TargetWriter as Writer;
|
||||
|
||||
use crate::git;
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::{reader, sessions, virtual_branches::BranchId};
|
||||
|
||||
use super::Target;
|
||||
use crate::{reader, sessions, virtual_branches::BranchId};
|
||||
|
||||
pub struct TargetReader<'r> {
|
||||
reader: &'r reader::Reader<'r>,
|
||||
|
@ -2,14 +2,13 @@ use std::path;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
|
||||
use super::Target;
|
||||
use crate::{
|
||||
gb_repository, reader,
|
||||
virtual_branches::{state::VirtualBranchesHandle, BranchId},
|
||||
writer,
|
||||
};
|
||||
|
||||
use super::Target;
|
||||
|
||||
pub struct TargetWriter<'writer> {
|
||||
repository: &'writer gb_repository::Repository,
|
||||
writer: writer::DirWriter,
|
||||
|
@ -1,3 +1,5 @@
|
||||
#[cfg(target_family = "unix")]
|
||||
use std::os::unix::prelude::*;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
hash::Hash,
|
||||
@ -5,9 +7,6 @@ use std::{
|
||||
time, vec,
|
||||
};
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
use std::os::unix::prelude::*;
|
||||
|
||||
use anyhow::{bail, Context, Result};
|
||||
use bstr::ByteSlice;
|
||||
use diffy::{apply, Patch};
|
||||
@ -15,6 +14,12 @@ use git2_hooks::HookResult;
|
||||
use regex::Regex;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::{
|
||||
branch::{
|
||||
self, Branch, BranchCreateRequest, BranchId, BranchOwnershipClaims, Hunk, OwnershipClaim,
|
||||
},
|
||||
branch_to_remote_branch, context, errors, target, Iterator, RemoteBranch,
|
||||
};
|
||||
use crate::{
|
||||
askpass::AskpassBroker,
|
||||
dedup::{dedup, dedup_fmt},
|
||||
@ -29,13 +34,6 @@ use crate::{
|
||||
reader, sessions, users,
|
||||
};
|
||||
|
||||
use super::{
|
||||
branch::{
|
||||
self, Branch, BranchCreateRequest, BranchId, BranchOwnershipClaims, Hunk, OwnershipClaim,
|
||||
},
|
||||
branch_to_remote_branch, context, errors, target, Iterator, RemoteBranch,
|
||||
};
|
||||
|
||||
type AppliedStatuses = Vec<(branch::Branch, HashMap<PathBuf, Vec<diff::GitHunk>>)>;
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
|
@ -1,6 +1,4 @@
|
||||
pub mod controller;
|
||||
pub use controller::Controller;
|
||||
|
||||
use std::{
|
||||
fs,
|
||||
io::{self, Read, Write},
|
||||
@ -8,6 +6,7 @@ use std::{
|
||||
};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
pub use controller::Controller;
|
||||
use sha2::{Digest, Sha256};
|
||||
use walkdir::{DirEntry, WalkDir};
|
||||
use zip::{result::ZipError, write, CompressionMethod, ZipWriter};
|
||||
|
@ -1,8 +1,7 @@
|
||||
use std::path;
|
||||
|
||||
use crate::projects::{self, ProjectId};
|
||||
|
||||
use super::Zipper;
|
||||
use crate::projects::{self, ProjectId};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Controller {
|
||||
|
@ -1,6 +1,7 @@
|
||||
use crate::shared::temp_dir;
|
||||
use gitbutler::database::Database;
|
||||
|
||||
use crate::shared::temp_dir;
|
||||
|
||||
#[test]
|
||||
fn smoke() {
|
||||
let data_dir = temp_dir();
|
||||
|
@ -1,6 +1,7 @@
|
||||
use gitbutler::deltas::operations::Operation;
|
||||
use gitbutler::deltas::{Delta, Document};
|
||||
use gitbutler::reader;
|
||||
use gitbutler::{
|
||||
deltas::{operations::Operation, Delta, Document},
|
||||
reader,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn new() {
|
||||
|
@ -1,10 +1,14 @@
|
||||
mod database {
|
||||
use crate::shared::test_database;
|
||||
use gitbutler::deltas::{operations, Database, Delta};
|
||||
use gitbutler::projects::ProjectId;
|
||||
use gitbutler::sessions::SessionId;
|
||||
use std::path;
|
||||
|
||||
use gitbutler::{
|
||||
deltas::{operations, Database, Delta},
|
||||
projects::ProjectId,
|
||||
sessions::SessionId,
|
||||
};
|
||||
|
||||
use crate::shared::test_database;
|
||||
|
||||
#[test]
|
||||
fn insert_query() -> anyhow::Result<()> {
|
||||
let (db, _tmp) = test_database();
|
||||
@ -107,10 +111,10 @@ mod document;
|
||||
mod operations;
|
||||
|
||||
mod writer {
|
||||
use gitbutler::deltas::operations::Operation;
|
||||
use gitbutler::{deltas, sessions};
|
||||
use std::vec;
|
||||
|
||||
use gitbutler::{deltas, deltas::operations::Operation, sessions};
|
||||
|
||||
use crate::shared::{Case, Suite};
|
||||
|
||||
#[test]
|
||||
|
@ -1,26 +1,25 @@
|
||||
use std::{collections::HashMap, path, thread, time};
|
||||
|
||||
use anyhow::Result;
|
||||
use pretty_assertions::assert_eq;
|
||||
use tempfile::TempDir;
|
||||
|
||||
use crate::shared::init_opts_bare;
|
||||
use crate::shared::{Case, Suite};
|
||||
|
||||
use gitbutler::{
|
||||
deltas::{self, operations::Operation},
|
||||
projects::{self, ApiProject, ProjectId},
|
||||
reader,
|
||||
sessions::{self, SessionId},
|
||||
};
|
||||
use pretty_assertions::assert_eq;
|
||||
use tempfile::TempDir;
|
||||
|
||||
use crate::shared::{init_opts_bare, Case, Suite};
|
||||
|
||||
mod repository {
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::shared::{Case, Suite};
|
||||
use anyhow::Result;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use crate::shared::{Case, Suite};
|
||||
|
||||
#[test]
|
||||
fn alternates_file_being_set() -> Result<()> {
|
||||
let suite = Suite::default();
|
||||
|
@ -1,7 +1,10 @@
|
||||
use gitbutler::git::credentials::{Credential, Helper, HttpsCredential, SshCredential};
|
||||
use gitbutler::{keys, project_repository, projects, users};
|
||||
use std::path::PathBuf;
|
||||
|
||||
use gitbutler::{
|
||||
git::credentials::{Credential, Helper, HttpsCredential, SshCredential},
|
||||
keys, project_repository, projects, users,
|
||||
};
|
||||
|
||||
use crate::shared::{temp_dir, test_repository};
|
||||
|
||||
#[derive(Default)]
|
||||
|
@ -1,17 +1,16 @@
|
||||
use std::{collections::HashMap, path, thread, time};
|
||||
|
||||
use anyhow::Result;
|
||||
use pretty_assertions::assert_eq;
|
||||
use tempfile::TempDir;
|
||||
|
||||
use crate::shared::init_opts_bare;
|
||||
use crate::shared::{Case, Suite};
|
||||
use gitbutler::{
|
||||
deltas::{self, operations::Operation},
|
||||
projects::{self, ApiProject, ProjectId},
|
||||
reader,
|
||||
sessions::{self, SessionId},
|
||||
};
|
||||
use pretty_assertions::assert_eq;
|
||||
use tempfile::TempDir;
|
||||
|
||||
use crate::shared::{init_opts_bare, Case, Suite};
|
||||
|
||||
fn new_test_remote_repository() -> Result<(git2::Repository, TempDir)> {
|
||||
let tmp = tempfile::tempdir()?;
|
||||
|
@ -3,12 +3,12 @@ use gitbutler::keys::{PrivateKey, PublicKey};
|
||||
mod controller {
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
mod not_windows {
|
||||
use gitbutler::keys::storage::Storage;
|
||||
use gitbutler::keys::Controller;
|
||||
use std::fs;
|
||||
#[cfg(target_family = "unix")]
|
||||
use std::os::unix::prelude::*;
|
||||
|
||||
use gitbutler::keys::{storage::Storage, Controller};
|
||||
|
||||
use crate::shared::Suite;
|
||||
|
||||
#[test]
|
||||
|
@ -1,9 +1,9 @@
|
||||
use std::{fs, path::Path};
|
||||
|
||||
use anyhow::Result;
|
||||
use gitbutler::reader::{CommitReader, Content, Reader};
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
use crate::shared::{commit_all, temp_dir, test_repository};
|
||||
use anyhow::Result;
|
||||
|
||||
#[test]
|
||||
fn directory_reader_read_file() -> Result<()> {
|
||||
|
@ -1,6 +1,9 @@
|
||||
use gitbutler::{
|
||||
projects::ProjectId,
|
||||
sessions::{session, Database, Session, SessionId},
|
||||
};
|
||||
|
||||
use crate::shared::test_database;
|
||||
use gitbutler::projects::ProjectId;
|
||||
use gitbutler::sessions::{session, Database, Session, SessionId};
|
||||
|
||||
#[test]
|
||||
fn insert_query() -> anyhow::Result<()> {
|
||||
|
@ -1,9 +1,9 @@
|
||||
mod database;
|
||||
|
||||
use anyhow::Result;
|
||||
use gitbutler::sessions::{self, session::SessionId};
|
||||
|
||||
use crate::shared::{Case, Suite};
|
||||
use gitbutler::sessions::{self, session::SessionId};
|
||||
|
||||
#[test]
|
||||
fn should_not_write_session_with_hash() {
|
||||
|
@ -7,18 +7,20 @@ mod suite;
|
||||
pub use suite::*;
|
||||
|
||||
pub mod paths {
|
||||
use super::temp_dir;
|
||||
use tempfile::TempDir;
|
||||
|
||||
use super::temp_dir;
|
||||
|
||||
pub fn data_dir() -> TempDir {
|
||||
temp_dir()
|
||||
}
|
||||
}
|
||||
|
||||
pub mod virtual_branches {
|
||||
use crate::shared::empty_bare_repository;
|
||||
use gitbutler::{gb_repository, project_repository, virtual_branches};
|
||||
|
||||
use crate::shared::empty_bare_repository;
|
||||
|
||||
pub fn set_test_target(
|
||||
gb_repo: &gb_repository::Repository,
|
||||
project_repository: &project_repository::Repository,
|
||||
|
@ -1,8 +1,12 @@
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{collections::HashMap, fs};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fs,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use tempfile::{tempdir, TempDir};
|
||||
|
||||
use crate::shared::{init_opts, init_opts_bare, VAR_NO_CLEANUP};
|
||||
use tempfile::{tempdir, TempDir};
|
||||
|
||||
pub struct Suite {
|
||||
pub local_app_data: Option<TempDir>,
|
||||
|
@ -1,10 +1,12 @@
|
||||
#![allow(unused)]
|
||||
|
||||
use crate::shared::{init_opts, VAR_NO_CLEANUP};
|
||||
use gitbutler::git;
|
||||
use std::{path, str::from_utf8};
|
||||
|
||||
use gitbutler::git;
|
||||
use tempfile::TempDir;
|
||||
|
||||
use crate::shared::{init_opts, VAR_NO_CLEANUP};
|
||||
|
||||
pub fn temp_dir() -> TempDir {
|
||||
tempfile::tempdir().unwrap()
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
use crate::shared::{paths, TestProject};
|
||||
use gitbutler::{gb_repository, git, project_repository, projects};
|
||||
use std::path;
|
||||
|
||||
use gitbutler::{gb_repository, git, project_repository, projects};
|
||||
|
||||
use crate::shared::{paths, TestProject};
|
||||
|
||||
mod init {
|
||||
use super::*;
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
use std::{fs, path, str::FromStr};
|
||||
use tempfile::TempDir;
|
||||
|
||||
use crate::shared::VAR_NO_CLEANUP;
|
||||
use crate::shared::{paths, TestProject};
|
||||
use gitbutler::{
|
||||
git, keys,
|
||||
projects::{self, ProjectId},
|
||||
users,
|
||||
virtual_branches::{branch, controller::ControllerError, errors, Controller},
|
||||
};
|
||||
use tempfile::TempDir;
|
||||
|
||||
use crate::shared::{paths, TestProject, VAR_NO_CLEANUP};
|
||||
|
||||
struct Test {
|
||||
repository: TestProject,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user