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