mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-23 01:22:12 +03:00
move project module in a separate gitbutler-project crate
This commit is contained in:
parent
f7094fcdff
commit
e93896621f
31
Cargo.lock
generated
31
Cargo.lock
generated
@ -2117,6 +2117,7 @@ dependencies = [
|
||||
"gitbutler-core",
|
||||
"gitbutler-git",
|
||||
"gitbutler-oplog",
|
||||
"gitbutler-project",
|
||||
"gitbutler-repo",
|
||||
"gitbutler-testsupport",
|
||||
"glob",
|
||||
@ -2140,6 +2141,7 @@ version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"gitbutler-core",
|
||||
"gitbutler-project",
|
||||
"itertools 0.13.0",
|
||||
"serde",
|
||||
"toml 0.8.14",
|
||||
@ -2154,6 +2156,7 @@ dependencies = [
|
||||
"clap",
|
||||
"gitbutler-core",
|
||||
"gitbutler-oplog",
|
||||
"gitbutler-project",
|
||||
"pager",
|
||||
]
|
||||
|
||||
@ -2164,6 +2167,7 @@ dependencies = [
|
||||
"anyhow",
|
||||
"git2",
|
||||
"gitbutler-core",
|
||||
"gitbutler-project",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -2174,6 +2178,7 @@ dependencies = [
|
||||
"anyhow",
|
||||
"git2",
|
||||
"gitbutler-core",
|
||||
"gitbutler-project",
|
||||
"serde",
|
||||
]
|
||||
|
||||
@ -2233,6 +2238,7 @@ version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"gitbutler-core",
|
||||
"gitbutler-project",
|
||||
"sha2",
|
||||
"tempfile",
|
||||
"walkdir",
|
||||
@ -2282,6 +2288,7 @@ dependencies = [
|
||||
"git2",
|
||||
"gitbutler-branchstate",
|
||||
"gitbutler-core",
|
||||
"gitbutler-project",
|
||||
"gitbutler-repo",
|
||||
"gix",
|
||||
"itertools 0.13.0",
|
||||
@ -2293,6 +2300,25 @@ dependencies = [
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gitbutler-project"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"git2",
|
||||
"gitbutler-core",
|
||||
"gitbutler-testsupport",
|
||||
"gix",
|
||||
"resolve-path",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tempfile",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gitbutler-repo"
|
||||
version = "0.0.0"
|
||||
@ -2304,6 +2330,7 @@ dependencies = [
|
||||
"gitbutler-config",
|
||||
"gitbutler-core",
|
||||
"gitbutler-git",
|
||||
"gitbutler-project",
|
||||
"gitbutler-testsupport",
|
||||
"resolve-path",
|
||||
"serde_json",
|
||||
@ -2323,6 +2350,7 @@ dependencies = [
|
||||
"gitbutler-command-context",
|
||||
"gitbutler-core",
|
||||
"gitbutler-oplog",
|
||||
"gitbutler-project",
|
||||
"itertools 0.13.0",
|
||||
"tracing",
|
||||
]
|
||||
@ -2344,6 +2372,7 @@ dependencies = [
|
||||
"gitbutler-core",
|
||||
"gitbutler-feedback",
|
||||
"gitbutler-oplog",
|
||||
"gitbutler-project",
|
||||
"gitbutler-repo",
|
||||
"gitbutler-testsupport",
|
||||
"gitbutler-watcher",
|
||||
@ -2380,6 +2409,7 @@ dependencies = [
|
||||
"gitbutler-branchstate",
|
||||
"gitbutler-command-context",
|
||||
"gitbutler-core",
|
||||
"gitbutler-project",
|
||||
"gitbutler-repo",
|
||||
"keyring",
|
||||
"once_cell",
|
||||
@ -2400,6 +2430,7 @@ dependencies = [
|
||||
"gitbutler-core",
|
||||
"gitbutler-notify-debouncer",
|
||||
"gitbutler-oplog",
|
||||
"gitbutler-project",
|
||||
"gitbutler-sync",
|
||||
"gix",
|
||||
"notify",
|
||||
|
@ -15,6 +15,7 @@ members = [
|
||||
"crates/gitbutler-command-context",
|
||||
"crates/gitbutler-feedback",
|
||||
"crates/gitbutler-config",
|
||||
"crates/gitbutler-project",
|
||||
]
|
||||
resolver = "2"
|
||||
|
||||
@ -41,6 +42,7 @@ gitbutler-repo = { path = "crates/gitbutler-repo" }
|
||||
gitbutler-command-context = { path = "crates/gitbutler-command-context" }
|
||||
gitbutler-feedback = { path = "crates/gitbutler-feedback" }
|
||||
gitbutler-config = { path = "crates/gitbutler-config" }
|
||||
gitbutler-project = { path = "crates/gitbutler-project" }
|
||||
|
||||
[profile.release]
|
||||
codegen-units = 1 # Compile crates one after another so the compiler can optimize better
|
||||
|
@ -25,6 +25,7 @@ md5 = "0.7.0"
|
||||
futures = "0.3"
|
||||
itertools = "0.13"
|
||||
gitbutler-command-context.workspace = true
|
||||
gitbutler-project.workspace = true
|
||||
|
||||
[[test]]
|
||||
name="branches"
|
||||
|
@ -4,6 +4,7 @@ use anyhow::{anyhow, Context, Result};
|
||||
use git2::Index;
|
||||
use gitbutler_branchstate::{VirtualBranchesAccess, VirtualBranchesHandle};
|
||||
use gitbutler_command_context::ProjectRepo;
|
||||
use gitbutler_project::FetchResult;
|
||||
use gitbutler_repo::{LogUntil, RepoActions, RepositoryExt};
|
||||
use serde::Serialize;
|
||||
|
||||
@ -17,7 +18,6 @@ use gitbutler_core::error::Marker;
|
||||
use gitbutler_core::virtual_branches::{branch, target, BranchId, GITBUTLER_INTEGRATION_REFERENCE};
|
||||
use gitbutler_core::{
|
||||
git::{self, diff},
|
||||
projects::FetchResult,
|
||||
virtual_branches::branch::BranchOwnershipClaims,
|
||||
};
|
||||
use gitbutler_repo::rebase::cherry_rebase;
|
||||
|
@ -1,12 +1,13 @@
|
||||
use anyhow::Result;
|
||||
use gitbutler_branchstate::{VirtualBranchesAccess, VirtualBranchesHandle};
|
||||
use gitbutler_command_context::ProjectRepo;
|
||||
use gitbutler_core::{git::BranchExt, projects::FetchResult, types::ReferenceName};
|
||||
use gitbutler_core::{git::BranchExt, types::ReferenceName};
|
||||
use gitbutler_oplog::{
|
||||
entry::{OperationKind, SnapshotDetails},
|
||||
oplog::Oplog,
|
||||
snapshot::Snapshot,
|
||||
};
|
||||
use gitbutler_project::{FetchResult, Project};
|
||||
use gitbutler_repo::{credentials::Helper, RepoActions, RepositoryExt};
|
||||
use std::{path::Path, sync::Arc};
|
||||
|
||||
@ -24,14 +25,11 @@ use super::r#virtual as branch;
|
||||
use gitbutler_core::virtual_branches;
|
||||
|
||||
use crate::files::RemoteBranchFile;
|
||||
use gitbutler_core::git;
|
||||
use gitbutler_core::virtual_branches::{
|
||||
branch::{BranchId, BranchOwnershipClaims},
|
||||
target,
|
||||
};
|
||||
use gitbutler_core::{
|
||||
git,
|
||||
projects::{self, Project},
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Controller {
|
||||
@ -450,7 +448,7 @@ impl Controller {
|
||||
.collect();
|
||||
|
||||
let project_data_last_fetched = if fetch_results.iter().any(Result::is_err) {
|
||||
projects::FetchResult::Error {
|
||||
FetchResult::Error {
|
||||
timestamp: std::time::SystemTime::now(),
|
||||
error: fetch_results
|
||||
.iter()
|
||||
@ -462,7 +460,7 @@ impl Controller {
|
||||
.join("\n"),
|
||||
}
|
||||
} else {
|
||||
projects::FetchResult::Fetched {
|
||||
FetchResult::Fetched {
|
||||
timestamp: std::time::SystemTime::now(),
|
||||
}
|
||||
};
|
||||
|
@ -3,11 +3,8 @@ use std::{fs, path, str::FromStr};
|
||||
|
||||
use gitbutler_branch::Controller;
|
||||
use gitbutler_core::error::Marker;
|
||||
use gitbutler_core::{
|
||||
git,
|
||||
projects::{self, Project, ProjectId},
|
||||
virtual_branches::branch,
|
||||
};
|
||||
use gitbutler_core::{git, virtual_branches::branch};
|
||||
use gitbutler_project::{self as projects, Project, ProjectId};
|
||||
use tempfile::TempDir;
|
||||
|
||||
use gitbutler_testsupport::{paths, TestProject, VAR_NO_CLEANUP};
|
||||
|
@ -11,3 +11,4 @@ itertools = "0.13"
|
||||
anyhow = "1.0.86"
|
||||
toml = "0.8.13"
|
||||
serde = { workspace = true, features = ["std"]}
|
||||
gitbutler-project.workspace = true
|
||||
|
@ -4,7 +4,8 @@ use std::{
|
||||
};
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use gitbutler_core::{error::Code, fs::read_toml_file_or_default, projects::Project};
|
||||
use gitbutler_core::{error::Code, fs::read_toml_file_or_default};
|
||||
use gitbutler_project::Project;
|
||||
use itertools::Itertools;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
@ -12,6 +12,7 @@ path = "src/main.rs"
|
||||
[dependencies]
|
||||
gitbutler-core.workspace = true
|
||||
gitbutler-oplog.workspace = true
|
||||
gitbutler-project.workspace = true
|
||||
clap = "4.5.4"
|
||||
anyhow = "1.0.86"
|
||||
chrono = "0.4.10"
|
||||
|
@ -1,8 +1,8 @@
|
||||
use anyhow::Result;
|
||||
use gitbutler_core::projects::Project;
|
||||
use gitbutler_oplog::oplog::Oplog;
|
||||
|
||||
use clap::{arg, Command};
|
||||
use gitbutler_project::Project;
|
||||
#[cfg(not(windows))]
|
||||
use pager::Pager;
|
||||
|
||||
|
@ -10,3 +10,4 @@ gitbutler-core.workspace = true
|
||||
anyhow = "1.0.86"
|
||||
git2.workspace = true
|
||||
tracing = "0.1.40"
|
||||
gitbutler-project.workspace = true
|
||||
|
@ -1,14 +1,13 @@
|
||||
use anyhow::Result;
|
||||
|
||||
use gitbutler_core::projects;
|
||||
use gitbutler_project::Project;
|
||||
|
||||
pub struct ProjectRepo {
|
||||
git_repository: git2::Repository,
|
||||
project: projects::Project,
|
||||
project: Project,
|
||||
}
|
||||
|
||||
impl ProjectRepo {
|
||||
pub fn open(project: &projects::Project) -> Result<Self> {
|
||||
pub fn open(project: &Project) -> Result<Self> {
|
||||
let repo = git2::Repository::open(&project.path)?;
|
||||
|
||||
// XXX(qix-): This is a temporary measure to disable GC on the project repository.
|
||||
@ -60,11 +59,11 @@ impl ProjectRepo {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_project(&mut self, project: &projects::Project) {
|
||||
pub fn set_project(&mut self, project: &Project) {
|
||||
self.project = project.clone();
|
||||
}
|
||||
|
||||
pub fn project(&self) -> &projects::Project {
|
||||
pub fn project(&self) -> &Project {
|
||||
&self.project
|
||||
}
|
||||
|
||||
|
@ -10,3 +10,4 @@ gitbutler-core.workspace = true
|
||||
git2.workspace = true
|
||||
anyhow = "1.0.86"
|
||||
serde = { workspace = true, features = ["std"]}
|
||||
gitbutler-project.workspace = true
|
||||
|
@ -1,5 +1,5 @@
|
||||
use anyhow::Result;
|
||||
use gitbutler_core::projects::Project;
|
||||
use gitbutler_project::Project;
|
||||
|
||||
use super::git::{GbConfig, GitConfig};
|
||||
|
||||
|
@ -24,7 +24,6 @@ pub mod keys;
|
||||
pub mod lock;
|
||||
pub mod path;
|
||||
pub mod project_repository;
|
||||
pub mod projects;
|
||||
pub mod secret;
|
||||
pub mod serde;
|
||||
pub mod ssh;
|
||||
|
@ -1,7 +1,3 @@
|
||||
mod suite {
|
||||
mod projects;
|
||||
}
|
||||
|
||||
mod keys;
|
||||
mod lock;
|
||||
mod types;
|
||||
|
@ -11,6 +11,7 @@ anyhow = "1.0.86"
|
||||
zip = "0.6.5"
|
||||
walkdir = "2.5.0"
|
||||
sha2 = "0.10.8"
|
||||
gitbutler-project.workspace = true
|
||||
|
||||
[[test]]
|
||||
name="feedback"
|
||||
|
@ -1,7 +1,8 @@
|
||||
use anyhow::Result;
|
||||
use std::path;
|
||||
|
||||
use gitbutler_core::projects::{self, ProjectId};
|
||||
use gitbutler_project as projects;
|
||||
use gitbutler_project::ProjectId;
|
||||
|
||||
use crate::zipper::Zipper;
|
||||
|
||||
|
@ -17,6 +17,7 @@ strum = { version = "0.26", features = ["derive"] }
|
||||
tracing = "0.1.40"
|
||||
gix = { workspace = true, features = ["dirwalk", "credentials", "parallel"] }
|
||||
toml = "0.8.13"
|
||||
gitbutler-project.workspace = true
|
||||
|
||||
[[test]]
|
||||
name="oplog"
|
||||
|
@ -1,6 +1,7 @@
|
||||
use anyhow::{anyhow, bail, Context};
|
||||
use git2::{DiffOptions, FileMode};
|
||||
use gitbutler_branchstate::{VirtualBranchesAccess, VirtualBranchesState};
|
||||
use gitbutler_project::Project;
|
||||
use gitbutler_repo::RepositoryExt;
|
||||
use std::collections::HashMap;
|
||||
use std::path::Path;
|
||||
@ -11,11 +12,11 @@ use std::{fs, path::PathBuf};
|
||||
use anyhow::Result;
|
||||
use tracing::instrument;
|
||||
|
||||
use gitbutler_core::git::diff::hunks_by_filepath;
|
||||
use gitbutler_core::git::diff::FileDiff;
|
||||
use gitbutler_core::virtual_branches::{
|
||||
Branch, GITBUTLER_INTEGRATION_COMMIT_AUTHOR_EMAIL, GITBUTLER_INTEGRATION_COMMIT_AUTHOR_NAME,
|
||||
};
|
||||
use gitbutler_core::{git::diff::hunks_by_filepath, projects::Project};
|
||||
|
||||
use super::{
|
||||
entry::{OperationKind, Snapshot, SnapshotDetails, Trailer},
|
||||
|
@ -1,11 +1,11 @@
|
||||
use anyhow::Result;
|
||||
use gitbutler_project::Project;
|
||||
use std::vec;
|
||||
|
||||
use crate::{
|
||||
entry::{OperationKind, SnapshotDetails},
|
||||
oplog::Oplog,
|
||||
};
|
||||
use gitbutler_core::projects::Project;
|
||||
use gitbutler_core::virtual_branches::{branch::BranchUpdateRequest, Branch};
|
||||
|
||||
use super::entry::Trailer;
|
||||
|
27
crates/gitbutler-project/Cargo.toml
Normal file
27
crates/gitbutler-project/Cargo.toml
Normal file
@ -0,0 +1,27 @@
|
||||
[package]
|
||||
name = "gitbutler-project"
|
||||
version = "0.0.0"
|
||||
edition = "2021"
|
||||
authors = ["GitButler <gitbutler@gitbutler.com>"]
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.86"
|
||||
serde = { workspace = true, features = ["std"]}
|
||||
serde_json = { version = "1.0", features = [ "std", "arbitrary_precision" ] }
|
||||
gitbutler-core.workspace = true
|
||||
git2.workspace = true
|
||||
async-trait = "0.1.80"
|
||||
gix = { workspace = true, features = ["dirwalk", "credentials", "parallel"] }
|
||||
uuid.workspace = true
|
||||
tracing = "0.1.40"
|
||||
resolve-path = "0.1.0"
|
||||
|
||||
[[test]]
|
||||
name="project"
|
||||
path = "tests/mod.rs"
|
||||
|
||||
[dev-dependencies]
|
||||
gitbutler-testsupport.workspace = true
|
||||
tempfile = "3.10"
|
||||
tokio = { workspace = true, features = [ "rt-multi-thread", "rt", "macros" ] }
|
@ -7,8 +7,8 @@ use anyhow::{bail, Context, Result};
|
||||
use async_trait::async_trait;
|
||||
|
||||
use super::{storage, storage::UpdateRequest, Project, ProjectId};
|
||||
use crate::error;
|
||||
use crate::projects::AuthKey;
|
||||
use crate::AuthKey;
|
||||
use gitbutler_core::error;
|
||||
|
||||
#[async_trait]
|
||||
pub trait Watchers {
|
@ -5,7 +5,7 @@ use std::{
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{id::Id, types::default_true::DefaultTrue};
|
||||
use gitbutler_core::{id::Id, types::default_true::DefaultTrue};
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
@ -54,7 +54,7 @@ impl FetchResult {
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Copy, Clone)]
|
||||
pub struct CodePushState {
|
||||
#[serde(with = "crate::serde::oid")]
|
||||
#[serde(with = "gitbutler_core::serde::oid")]
|
||||
pub id: git2::Oid,
|
||||
pub timestamp: time::SystemTime,
|
||||
}
|
@ -2,10 +2,9 @@ use anyhow::{Context, Result};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::{
|
||||
projects::{project, ProjectId},
|
||||
storage,
|
||||
};
|
||||
use gitbutler_core::storage;
|
||||
|
||||
use crate::{ApiProject, AuthKey, CodePushState, FetchResult, Project, ProjectId};
|
||||
|
||||
const PROJECTS_FILE: &str = "projects.json";
|
||||
|
||||
@ -19,12 +18,12 @@ pub struct UpdateRequest {
|
||||
pub id: ProjectId,
|
||||
pub title: Option<String>,
|
||||
pub description: Option<String>,
|
||||
pub api: Option<project::ApiProject>,
|
||||
pub gitbutler_data_last_fetched: Option<project::FetchResult>,
|
||||
pub preferred_key: Option<project::AuthKey>,
|
||||
pub api: Option<ApiProject>,
|
||||
pub gitbutler_data_last_fetched: Option<FetchResult>,
|
||||
pub preferred_key: Option<AuthKey>,
|
||||
pub ok_with_force_push: Option<bool>,
|
||||
pub gitbutler_code_push_state: Option<project::CodePushState>,
|
||||
pub project_data_last_fetched: Option<project::FetchResult>,
|
||||
pub gitbutler_code_push_state: Option<CodePushState>,
|
||||
pub project_data_last_fetched: Option<FetchResult>,
|
||||
pub omit_certificate_check: Option<bool>,
|
||||
pub use_diff_context: Option<bool>,
|
||||
pub snapshot_lines_threshold: Option<usize>,
|
||||
@ -41,10 +40,10 @@ impl Storage {
|
||||
Self::new(storage::Storage::new(path))
|
||||
}
|
||||
|
||||
pub fn list(&self) -> Result<Vec<project::Project>> {
|
||||
pub fn list(&self) -> Result<Vec<Project>> {
|
||||
match self.inner.read(PROJECTS_FILE)? {
|
||||
Some(projects) => {
|
||||
let all_projects: Vec<project::Project> = serde_json::from_str(&projects)?;
|
||||
let all_projects: Vec<Project> = serde_json::from_str(&projects)?;
|
||||
let mut all_projects: Vec<_> = all_projects
|
||||
.into_iter()
|
||||
.map(|mut p| {
|
||||
@ -65,17 +64,17 @@ impl Storage {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get(&self, id: ProjectId) -> Result<project::Project> {
|
||||
pub fn get(&self, id: ProjectId) -> Result<Project> {
|
||||
self.try_get(id)?
|
||||
.with_context(|| format!("project {id} not found"))
|
||||
}
|
||||
|
||||
pub fn try_get(&self, id: ProjectId) -> Result<Option<project::Project>> {
|
||||
pub fn try_get(&self, id: ProjectId) -> Result<Option<Project>> {
|
||||
let projects = self.list()?;
|
||||
Ok(projects.into_iter().find(|p| p.id == id))
|
||||
}
|
||||
|
||||
pub fn update(&self, update_request: &UpdateRequest) -> Result<project::Project> {
|
||||
pub fn update(&self, update_request: &UpdateRequest) -> Result<Project> {
|
||||
let mut projects = self.list()?;
|
||||
let project = projects
|
||||
.iter_mut()
|
||||
@ -152,7 +151,7 @@ impl Storage {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn add(&self, project: &project::Project) -> Result<()> {
|
||||
pub fn add(&self, project: &Project) -> Result<()> {
|
||||
let mut projects = self.list()?;
|
||||
projects.push(project.clone());
|
||||
let projects = serde_json::to_string_pretty(&projects)?;
|
1
crates/gitbutler-project/tests/mod.rs
Normal file
1
crates/gitbutler-project/tests/mod.rs
Normal file
@ -0,0 +1 @@
|
||||
mod projects;
|
@ -1,4 +1,4 @@
|
||||
use gitbutler_core::projects::Controller;
|
||||
use gitbutler_project::Controller;
|
||||
use tempfile::TempDir;
|
||||
|
||||
use gitbutler_testsupport::{self, paths};
|
@ -18,6 +18,7 @@ thiserror.workspace = true
|
||||
resolve-path = "0.1.0"
|
||||
gitbutler-command-context.workspace = true
|
||||
gitbutler-config.workspace = true
|
||||
gitbutler-project.workspace = true
|
||||
|
||||
[[test]]
|
||||
name="repo"
|
||||
|
@ -1,7 +1,8 @@
|
||||
use anyhow::Result;
|
||||
use bstr::BString;
|
||||
use gitbutler_command_context::ProjectRepo;
|
||||
use gitbutler_core::{project_repository::Config, projects::Project};
|
||||
use gitbutler_core::project_repository::Config;
|
||||
use gitbutler_project::Project;
|
||||
|
||||
use crate::RepositoryExt;
|
||||
|
||||
|
@ -4,9 +4,10 @@ use std::{path::PathBuf, vec};
|
||||
use anyhow::Context;
|
||||
|
||||
use gitbutler_command_context::ProjectRepo;
|
||||
use gitbutler_core::{keys, projects};
|
||||
use gitbutler_core::keys;
|
||||
|
||||
use gitbutler_core::git::Url;
|
||||
use gitbutler_project::AuthKey;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum SshCredential {
|
||||
@ -104,7 +105,7 @@ impl Helper {
|
||||
}
|
||||
|
||||
match &project_repository.project().preferred_key {
|
||||
projects::AuthKey::Local { private_key_path } => {
|
||||
AuthKey::Local { private_key_path } => {
|
||||
let ssh_remote = if remote_url.scheme == gitbutler_core::git::Scheme::Ssh {
|
||||
Ok(remote)
|
||||
} else {
|
||||
@ -122,7 +123,7 @@ impl Helper {
|
||||
})],
|
||||
)])
|
||||
}
|
||||
projects::AuthKey::GitCredentialsHelper => {
|
||||
AuthKey::GitCredentialsHelper => {
|
||||
let https_remote = if remote_url.scheme == gitbutler_core::git::Scheme::Https {
|
||||
Ok(remote)
|
||||
} else {
|
||||
@ -135,7 +136,7 @@ impl Helper {
|
||||
.collect::<Vec<_>>();
|
||||
Ok(vec![(https_remote, flow)])
|
||||
}
|
||||
projects::AuthKey::SystemExecutable => {
|
||||
AuthKey::SystemExecutable => {
|
||||
tracing::error!("WARNING: FIXME: this codepath should NEVER be hit. Something is seriously wrong.");
|
||||
Ok(vec![])
|
||||
}
|
||||
|
@ -7,12 +7,12 @@ use gitbutler_core::{
|
||||
askpass,
|
||||
error::Code,
|
||||
git::{self, CommitHeadersV2},
|
||||
projects::AuthKey,
|
||||
ssh,
|
||||
virtual_branches::{Branch, BranchId},
|
||||
};
|
||||
|
||||
use gitbutler_core::project_repository::Config;
|
||||
use gitbutler_project::AuthKey;
|
||||
|
||||
use crate::{credentials::Helper, RepositoryExt};
|
||||
pub trait RepoActions {
|
||||
|
@ -2,7 +2,8 @@ use std::path::PathBuf;
|
||||
use std::str;
|
||||
|
||||
use gitbutler_command_context::ProjectRepo;
|
||||
use gitbutler_core::{projects, users};
|
||||
use gitbutler_core::users;
|
||||
use gitbutler_project as projects;
|
||||
use gitbutler_repo::credentials::{Credential, Helper, SshCredential};
|
||||
|
||||
use gitbutler_testsupport::{temp_dir, test_repository};
|
||||
|
@ -14,3 +14,4 @@ gitbutler-core.workspace = true
|
||||
gitbutler-oplog.workspace = true
|
||||
gitbutler-branchstate.workspace = true
|
||||
gitbutler-command-context.workspace = true
|
||||
gitbutler-project.workspace = true
|
||||
|
@ -8,12 +8,10 @@ use gitbutler_command_context::ProjectRepo;
|
||||
use gitbutler_core::error::Code;
|
||||
use gitbutler_core::git::Url;
|
||||
use gitbutler_core::id::Id;
|
||||
use gitbutler_core::{
|
||||
git,
|
||||
projects::{self, CodePushState},
|
||||
users,
|
||||
};
|
||||
use gitbutler_core::{git, users};
|
||||
use gitbutler_oplog::oplog::Oplog;
|
||||
use gitbutler_project as projects;
|
||||
use gitbutler_project::{CodePushState, Project};
|
||||
use itertools::Itertools;
|
||||
|
||||
pub async fn sync_with_gitbutler(
|
||||
@ -64,7 +62,7 @@ async fn push_target(
|
||||
project_repository: &ProjectRepo,
|
||||
default_target: &gitbutler_core::virtual_branches::target::Target,
|
||||
gb_code_last_commit: Option<git2::Oid>,
|
||||
project_id: Id<projects::Project>,
|
||||
project_id: Id<Project>,
|
||||
user: &users::User,
|
||||
batch_size: usize,
|
||||
) -> Result<()> {
|
||||
|
@ -54,6 +54,7 @@ gitbutler-repo.workspace = true
|
||||
gitbutler-command-context.workspace = true
|
||||
gitbutler-feedback.workspace = true
|
||||
gitbutler-config.workspace = true
|
||||
gitbutler-project.workspace = true
|
||||
open = "5"
|
||||
|
||||
[dependencies.tauri]
|
||||
|
@ -1,11 +1,9 @@
|
||||
use anyhow::{Context, Result};
|
||||
use gitbutler_branch::conflicts;
|
||||
use gitbutler_command_context::ProjectRepo;
|
||||
use gitbutler_core::{
|
||||
git,
|
||||
projects::{self, ProjectId},
|
||||
virtual_branches::BranchId,
|
||||
};
|
||||
use gitbutler_core::{git, virtual_branches::BranchId};
|
||||
use gitbutler_project as projects;
|
||||
use gitbutler_project::ProjectId;
|
||||
use gitbutler_repo::{credentials::Helper, RepoActions, RepositoryExt};
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,4 +1,5 @@
|
||||
use gitbutler_core::{git, projects::ProjectId};
|
||||
use gitbutler_core::git;
|
||||
use gitbutler_project::ProjectId;
|
||||
use gitbutler_repo::credentials::Helper;
|
||||
use tauri::Manager;
|
||||
use tracing::instrument;
|
||||
|
@ -1,6 +1,7 @@
|
||||
use crate::error::Error;
|
||||
use gitbutler_config::{api::ProjectCommands, git::GbConfig};
|
||||
use gitbutler_core::projects::{self, ProjectId};
|
||||
use gitbutler_project as projects;
|
||||
use gitbutler_project::ProjectId;
|
||||
use tauri::Manager;
|
||||
use tracing::instrument;
|
||||
|
||||
|
@ -104,7 +104,7 @@ fn main() {
|
||||
let watcher_controller = watcher::Watchers::new(app_handle.clone());
|
||||
app_handle.manage(watcher_controller.clone());
|
||||
|
||||
let projects_storage_controller = gitbutler_core::projects::storage::Storage::new(storage_controller.clone());
|
||||
let projects_storage_controller = gitbutler_project::storage::Storage::new(storage_controller.clone());
|
||||
app_handle.manage(projects_storage_controller.clone());
|
||||
|
||||
let users_storage_controller = gitbutler_core::users::storage::Storage::new(storage_controller.clone());
|
||||
@ -113,7 +113,7 @@ fn main() {
|
||||
let users_controller = gitbutler_core::users::Controller::new(users_storage_controller.clone());
|
||||
app_handle.manage(users_controller.clone());
|
||||
|
||||
let projects_controller = gitbutler_core::projects::Controller::new(
|
||||
let projects_controller = gitbutler_project::Controller::new(
|
||||
app_data_dir.clone(),
|
||||
projects_storage_controller.clone(),
|
||||
Some(watcher_controller.clone())
|
||||
|
@ -2,7 +2,8 @@ pub mod commands {
|
||||
use anyhow::Context;
|
||||
use std::path;
|
||||
|
||||
use gitbutler_core::projects::{self, controller::Controller, ProjectId};
|
||||
use gitbutler_project::ProjectId;
|
||||
use gitbutler_project::{self as projects, Controller};
|
||||
use tauri::Manager;
|
||||
use tracing::instrument;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
use crate::error::Error;
|
||||
use gitbutler_core::projects::{self, ProjectId};
|
||||
use gitbutler_project as projects;
|
||||
use gitbutler_project::ProjectId;
|
||||
use gitbutler_repo::RepoCommands;
|
||||
use tauri::Manager;
|
||||
use tracing::instrument;
|
||||
|
@ -1,6 +1,7 @@
|
||||
pub mod commands {
|
||||
use crate::error::Error;
|
||||
use gitbutler_core::projects::{self, ProjectId};
|
||||
use gitbutler_project as projects;
|
||||
use gitbutler_project::ProjectId;
|
||||
use gitbutler_repo::RepoCommands;
|
||||
use tauri::Manager;
|
||||
use tracing::instrument;
|
||||
|
@ -1,9 +1,10 @@
|
||||
use crate::error::Error;
|
||||
use anyhow::Context;
|
||||
use gitbutler_core::git::diff::FileDiff;
|
||||
use gitbutler_core::projects::{self, ProjectId};
|
||||
use gitbutler_oplog::entry::Snapshot;
|
||||
use gitbutler_oplog::oplog::Oplog;
|
||||
use gitbutler_project as projects;
|
||||
use gitbutler_project::ProjectId;
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
use tauri::Manager;
|
||||
|
@ -9,10 +9,11 @@ pub mod commands {
|
||||
assets,
|
||||
error::Code,
|
||||
git,
|
||||
projects::{self, ProjectId},
|
||||
types::ReferenceName,
|
||||
virtual_branches::branch::{self, BranchId, BranchOwnershipClaims},
|
||||
};
|
||||
use gitbutler_project as projects;
|
||||
use gitbutler_project::ProjectId;
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tracing::instrument;
|
||||
|
||||
|
@ -2,14 +2,15 @@ use std::sync::Arc;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use futures::executor::block_on;
|
||||
use gitbutler_core::projects::{self, Project, ProjectId};
|
||||
use gitbutler_core::{assets, users};
|
||||
use gitbutler_project as projects;
|
||||
use gitbutler_project::{Project, ProjectId};
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tracing::instrument;
|
||||
|
||||
mod event {
|
||||
use anyhow::{Context, Result};
|
||||
use gitbutler_core::projects::ProjectId;
|
||||
use gitbutler_project::ProjectId;
|
||||
use gitbutler_watcher::Change;
|
||||
use tauri::Manager;
|
||||
|
||||
@ -147,7 +148,7 @@ impl Watchers {
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl gitbutler_core::projects::Watchers for Watchers {
|
||||
impl projects::Watchers for Watchers {
|
||||
fn watch(&self, project: &Project) -> Result<()> {
|
||||
Watchers::watch(self, project)
|
||||
}
|
||||
|
@ -22,3 +22,4 @@ gitbutler-branch = { path = "../gitbutler-branch" }
|
||||
gitbutler-repo = { path = "../gitbutler-repo" }
|
||||
gitbutler-branchstate = { path = "../gitbutler-branchstate" }
|
||||
gitbutler-command-context.workspace = true
|
||||
gitbutler-project.workspace = true
|
||||
|
@ -15,7 +15,7 @@ pub struct Suite {
|
||||
pub local_app_data: Option<TempDir>,
|
||||
pub storage: gitbutler_core::storage::Storage,
|
||||
pub users: gitbutler_core::users::Controller,
|
||||
pub projects: gitbutler_core::projects::Controller,
|
||||
pub projects: gitbutler_project::Controller,
|
||||
pub keys: gitbutler_core::keys::Controller,
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ impl Default for Suite {
|
||||
let local_app_data = temp_dir();
|
||||
let storage = gitbutler_core::storage::Storage::new(local_app_data.path());
|
||||
let users = gitbutler_core::users::Controller::from_path(local_app_data.path());
|
||||
let projects = gitbutler_core::projects::Controller::from_path(local_app_data.path());
|
||||
let projects = gitbutler_project::Controller::from_path(local_app_data.path());
|
||||
let keys = gitbutler_core::keys::Controller::from_path(local_app_data.path());
|
||||
Self {
|
||||
storage,
|
||||
@ -57,7 +57,7 @@ impl Suite {
|
||||
user
|
||||
}
|
||||
|
||||
fn project(&self, fs: HashMap<PathBuf, &str>) -> (gitbutler_core::projects::Project, TempDir) {
|
||||
fn project(&self, fs: HashMap<PathBuf, &str>) -> (gitbutler_project::Project, TempDir) {
|
||||
let (repository, tmp) = test_repository();
|
||||
for (path, contents) in fs {
|
||||
if let Some(parent) = path.parent() {
|
||||
@ -91,7 +91,7 @@ impl Suite {
|
||||
}
|
||||
|
||||
pub struct Case {
|
||||
pub project: gitbutler_core::projects::Project,
|
||||
pub project: gitbutler_project::Project,
|
||||
pub project_repository: ProjectRepo,
|
||||
pub credentials: Helper,
|
||||
/// The directory containing the `project_repository`
|
||||
@ -111,7 +111,7 @@ impl Drop for Case {
|
||||
}
|
||||
|
||||
impl Case {
|
||||
fn new(project: gitbutler_core::projects::Project, project_tmp: TempDir) -> Case {
|
||||
fn new(project: gitbutler_project::Project, project_tmp: TempDir) -> Case {
|
||||
let project_repository =
|
||||
ProjectRepo::open(&project).expect("failed to create project repository");
|
||||
let credentials = Helper::default();
|
||||
|
@ -21,6 +21,7 @@ tokio-util = "0.7.11"
|
||||
tracing = "0.1.40"
|
||||
gix = { workspace = true, features = ["excludes"] }
|
||||
gitbutler-command-context.workspace = true
|
||||
gitbutler-project.workspace = true
|
||||
|
||||
|
||||
backoff = "0.4.0"
|
||||
|
@ -2,7 +2,7 @@ use std::fmt::Display;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use gitbutler_branch::VirtualBranches;
|
||||
use gitbutler_core::projects::ProjectId;
|
||||
use gitbutler_project::ProjectId;
|
||||
|
||||
/// An event for internal use, as merge between [super::file_monitor::Event] and [Action].
|
||||
#[derive(Debug)]
|
||||
|
@ -4,9 +4,9 @@ use std::time::Duration;
|
||||
|
||||
use crate::events::InternalEvent;
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use gitbutler_core::projects::ProjectId;
|
||||
use gitbutler_notify_debouncer::{new_debouncer, Debouncer, NoCache};
|
||||
use gitbutler_oplog::OPLOG_FILE_NAME;
|
||||
use gitbutler_project::ProjectId;
|
||||
use notify::RecommendedWatcher;
|
||||
use notify::Watcher;
|
||||
use tokio::task;
|
||||
|
@ -5,12 +5,13 @@ use anyhow::{Context, Result};
|
||||
use gitbutler_branch::VirtualBranches;
|
||||
use gitbutler_command_context::ProjectRepo;
|
||||
use gitbutler_core::error::Marker;
|
||||
use gitbutler_core::projects::ProjectId;
|
||||
use gitbutler_core::{assets, git, projects, users};
|
||||
use gitbutler_core::{assets, git, users};
|
||||
use gitbutler_oplog::{
|
||||
entry::{OperationKind, SnapshotDetails},
|
||||
oplog::Oplog,
|
||||
};
|
||||
use gitbutler_project as projects;
|
||||
use gitbutler_project::ProjectId;
|
||||
use gitbutler_sync::cloud::sync_with_gitbutler;
|
||||
use tracing::instrument;
|
||||
|
||||
|
@ -7,11 +7,11 @@ mod events;
|
||||
use events::InternalEvent;
|
||||
pub use events::{Action, Change};
|
||||
|
||||
use gitbutler_project::ProjectId;
|
||||
pub use handler::Handler;
|
||||
use std::path::Path;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use gitbutler_core::projects::ProjectId;
|
||||
use tokio::{
|
||||
sync::mpsc::{unbounded_channel, UnboundedSender},
|
||||
task,
|
||||
|
Loading…
Reference in New Issue
Block a user