mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-23 11:45:06 +03:00
Renaming crate gitbutler-branch to gitbutler-virtual
This is more descriptive to what logic lives inside. Further, this allows for splitting up the just branch bits in a separate crate (which is currently in gitbutler-core)
This commit is contained in:
parent
a8615f81f1
commit
0c9c781bd5
78
Cargo.lock
generated
78
Cargo.lock
generated
@ -2102,42 +2102,6 @@ dependencies = [
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gitbutler-branch"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bstr",
|
||||
"diffy",
|
||||
"futures",
|
||||
"git2",
|
||||
"git2-hooks",
|
||||
"gitbutler-branchstate",
|
||||
"gitbutler-command-context",
|
||||
"gitbutler-core",
|
||||
"gitbutler-git",
|
||||
"gitbutler-oplog",
|
||||
"gitbutler-project",
|
||||
"gitbutler-repo",
|
||||
"gitbutler-testsupport",
|
||||
"gitbutler-user",
|
||||
"glob",
|
||||
"hex",
|
||||
"itertools 0.13.0",
|
||||
"md5",
|
||||
"once_cell",
|
||||
"pretty_assertions",
|
||||
"regex",
|
||||
"reqwest 0.12.5",
|
||||
"serde",
|
||||
"serial_test",
|
||||
"tempfile",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"url",
|
||||
"urlencoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gitbutler-branchstate"
|
||||
version = "0.0.0"
|
||||
@ -2373,7 +2337,6 @@ dependencies = [
|
||||
"dirs 5.0.1",
|
||||
"futures",
|
||||
"git2",
|
||||
"gitbutler-branch",
|
||||
"gitbutler-command-context",
|
||||
"gitbutler-config",
|
||||
"gitbutler-core",
|
||||
@ -2383,6 +2346,7 @@ dependencies = [
|
||||
"gitbutler-repo",
|
||||
"gitbutler-testsupport",
|
||||
"gitbutler-user",
|
||||
"gitbutler-virtual",
|
||||
"gitbutler-watcher",
|
||||
"log",
|
||||
"nonzero_ext",
|
||||
@ -2413,13 +2377,13 @@ version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"git2",
|
||||
"gitbutler-branch",
|
||||
"gitbutler-branchstate",
|
||||
"gitbutler-command-context",
|
||||
"gitbutler-core",
|
||||
"gitbutler-project",
|
||||
"gitbutler-repo",
|
||||
"gitbutler-user",
|
||||
"gitbutler-virtual",
|
||||
"keyring",
|
||||
"once_cell",
|
||||
"pretty_assertions",
|
||||
@ -2440,6 +2404,42 @@ dependencies = [
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gitbutler-virtual"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bstr",
|
||||
"diffy",
|
||||
"futures",
|
||||
"git2",
|
||||
"git2-hooks",
|
||||
"gitbutler-branchstate",
|
||||
"gitbutler-command-context",
|
||||
"gitbutler-core",
|
||||
"gitbutler-git",
|
||||
"gitbutler-oplog",
|
||||
"gitbutler-project",
|
||||
"gitbutler-repo",
|
||||
"gitbutler-testsupport",
|
||||
"gitbutler-user",
|
||||
"glob",
|
||||
"hex",
|
||||
"itertools 0.13.0",
|
||||
"md5",
|
||||
"once_cell",
|
||||
"pretty_assertions",
|
||||
"regex",
|
||||
"reqwest 0.12.5",
|
||||
"serde",
|
||||
"serial_test",
|
||||
"tempfile",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"url",
|
||||
"urlencoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gitbutler-watcher"
|
||||
version = "0.0.0"
|
||||
@ -2447,7 +2447,6 @@ dependencies = [
|
||||
"anyhow",
|
||||
"backoff",
|
||||
"futures",
|
||||
"gitbutler-branch",
|
||||
"gitbutler-command-context",
|
||||
"gitbutler-core",
|
||||
"gitbutler-notify-debouncer",
|
||||
@ -2455,6 +2454,7 @@ dependencies = [
|
||||
"gitbutler-project",
|
||||
"gitbutler-sync",
|
||||
"gitbutler-user",
|
||||
"gitbutler-virtual",
|
||||
"gix",
|
||||
"notify",
|
||||
"thiserror",
|
||||
|
@ -7,7 +7,7 @@ members = [
|
||||
"crates/gitbutler-watcher/vendor/debouncer",
|
||||
"crates/gitbutler-testsupport",
|
||||
"crates/gitbutler-cli",
|
||||
"crates/gitbutler-branch",
|
||||
"crates/gitbutler-virtual",
|
||||
"crates/gitbutler-sync",
|
||||
"crates/gitbutler-oplog",
|
||||
"crates/gitbutler-branchstate",
|
||||
@ -35,7 +35,7 @@ gitbutler-core = { path = "crates/gitbutler-core" }
|
||||
gitbutler-watcher = { path = "crates/gitbutler-watcher" }
|
||||
gitbutler-testsupport = { path = "crates/gitbutler-testsupport" }
|
||||
gitbutler-cli ={ path = "crates/gitbutler-cli" }
|
||||
gitbutler-branch = { path = "crates/gitbutler-branch" }
|
||||
gitbutler-virtual = { path = "crates/gitbutler-virtual" }
|
||||
gitbutler-sync = { path = "crates/gitbutler-sync" }
|
||||
gitbutler-oplog = { path = "crates/gitbutler-oplog" }
|
||||
gitbutler-branchstate = { path = "crates/gitbutler-branchstate" }
|
||||
|
@ -48,7 +48,7 @@ tracing-appender = "0.2.3"
|
||||
tracing-subscriber = "0.3.17"
|
||||
gitbutler-core.workspace = true
|
||||
gitbutler-watcher.workspace = true
|
||||
gitbutler-branch.workspace = true
|
||||
gitbutler-virtual.workspace = true
|
||||
gitbutler-oplog.workspace = true
|
||||
gitbutler-repo.workspace = true
|
||||
gitbutler-command-context.workspace = true
|
||||
|
@ -1,10 +1,10 @@
|
||||
use anyhow::{Context, Result};
|
||||
use gitbutler_branch::conflicts;
|
||||
use gitbutler_command_context::ProjectRepo;
|
||||
use gitbutler_core::{git, virtual_branches::BranchId};
|
||||
use gitbutler_project as projects;
|
||||
use gitbutler_project::ProjectId;
|
||||
use gitbutler_repo::{credentials::Helper, RepoActions, RepositoryExt};
|
||||
use gitbutler_virtual::conflicts;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct App {
|
||||
|
@ -13,13 +13,13 @@
|
||||
clippy::too_many_lines
|
||||
)]
|
||||
|
||||
use gitbutler_branch::assets;
|
||||
use gitbutler_core::storage;
|
||||
use gitbutler_repo::credentials::Helper;
|
||||
use gitbutler_tauri::{
|
||||
app, askpass, commands, config, github, keys, logs, menu, projects, remotes, repo, secret,
|
||||
undo, users, virtual_branches, watcher, zip,
|
||||
};
|
||||
use gitbutler_virtual::assets;
|
||||
use tauri::{generate_context, Manager};
|
||||
use tauri_plugin_log::LogTarget;
|
||||
|
||||
@ -137,7 +137,7 @@ fn main() {
|
||||
let git_credentials_controller = Helper::default();
|
||||
app_handle.manage(git_credentials_controller.clone());
|
||||
|
||||
app_handle.manage(gitbutler_branch::controller::Controller::default());
|
||||
app_handle.manage(gitbutler_virtual::controller::Controller::default());
|
||||
|
||||
let app = app::App::new(
|
||||
projects_controller,
|
||||
|
@ -1,6 +1,6 @@
|
||||
pub mod commands {
|
||||
use gitbutler_branch::assets;
|
||||
use gitbutler_user::{controller::Controller, User};
|
||||
use gitbutler_virtual::assets;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tracing::instrument;
|
||||
|
@ -1,11 +1,6 @@
|
||||
pub mod commands {
|
||||
use crate::error::Error;
|
||||
use anyhow::{anyhow, Context};
|
||||
use gitbutler_branch::assets;
|
||||
use gitbutler_branch::base::BaseBranch;
|
||||
use gitbutler_branch::files::RemoteBranchFile;
|
||||
use gitbutler_branch::remote::{RemoteBranch, RemoteBranchData};
|
||||
use gitbutler_branch::{Controller, NameConflitResolution, VirtualBranches};
|
||||
use gitbutler_core::{
|
||||
error::Code,
|
||||
git,
|
||||
@ -14,6 +9,11 @@ pub mod commands {
|
||||
};
|
||||
use gitbutler_project as projects;
|
||||
use gitbutler_project::ProjectId;
|
||||
use gitbutler_virtual::assets;
|
||||
use gitbutler_virtual::base::BaseBranch;
|
||||
use gitbutler_virtual::files::RemoteBranchFile;
|
||||
use gitbutler_virtual::remote::{RemoteBranch, RemoteBranchData};
|
||||
use gitbutler_virtual::{Controller, NameConflitResolution, VirtualBranches};
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tracing::instrument;
|
||||
|
||||
|
@ -2,10 +2,10 @@ use std::sync::Arc;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use futures::executor::block_on;
|
||||
use gitbutler_branch::assets;
|
||||
use gitbutler_project as projects;
|
||||
use gitbutler_project::{Project, ProjectId};
|
||||
use gitbutler_user as users;
|
||||
use gitbutler_virtual::assets;
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tracing::instrument;
|
||||
|
||||
@ -78,7 +78,7 @@ pub struct Watchers {
|
||||
fn handler_from_app(app: &AppHandle) -> anyhow::Result<gitbutler_watcher::Handler> {
|
||||
let projects = app.state::<projects::Controller>().inner().clone();
|
||||
let users = app.state::<users::Controller>().inner().clone();
|
||||
let vbranches = app.state::<gitbutler_branch::Controller>().inner().clone();
|
||||
let vbranches = app.state::<gitbutler_virtual::Controller>().inner().clone();
|
||||
let assets_proxy = app.state::<assets::Proxy>().inner().clone();
|
||||
|
||||
Ok(gitbutler_watcher::Handler::new(
|
||||
|
@ -18,7 +18,7 @@ tempfile = "3.10.1"
|
||||
keyring.workspace = true
|
||||
serde_json = "1.0"
|
||||
gitbutler-core = { path = "../gitbutler-core" }
|
||||
gitbutler-branch = { path = "../gitbutler-branch" }
|
||||
gitbutler-virtual = { path = "../gitbutler-virtual" }
|
||||
gitbutler-repo = { path = "../gitbutler-repo" }
|
||||
gitbutler-branchstate = { path = "../gitbutler-branchstate" }
|
||||
gitbutler-command-context.workspace = true
|
||||
|
@ -42,7 +42,7 @@ pub mod virtual_branches {
|
||||
})
|
||||
.expect("failed to write target");
|
||||
|
||||
gitbutler_branch::integration::update_gitbutler_integration(&vb_state, project_repository)
|
||||
gitbutler_virtual::integration::update_gitbutler_integration(&vb_state, project_repository)
|
||||
.expect("failed to update integration");
|
||||
|
||||
Ok(())
|
||||
|
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "gitbutler-branch"
|
||||
name = "gitbutler-virtual"
|
||||
version = "0.0.0"
|
||||
edition = "2021"
|
||||
authors = ["GitButler <gitbutler@gitbutler.com>"]
|
||||
@ -31,7 +31,7 @@ urlencoding = "2.1.3"
|
||||
reqwest = { version = "0.12.4", features = ["json"] }
|
||||
|
||||
[[test]]
|
||||
name="branches"
|
||||
name="virtual"
|
||||
path = "tests/virtual_branches/mod.rs"
|
||||
|
||||
[dev-dependencies]
|
@ -11,18 +11,18 @@ use std::{
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use git2::TreeEntry;
|
||||
use gitbutler_branch::integration;
|
||||
use gitbutler_branch::r#virtual as virtual_branches;
|
||||
use gitbutler_branch::r#virtual::{
|
||||
commit, create_virtual_branch, create_virtual_branch_from_branch, integrate_upstream_commits,
|
||||
is_remote_branch_mergeable, list_virtual_branches, unapply_ownership, update_branch,
|
||||
};
|
||||
use gitbutler_branchstate::VirtualBranchesAccess;
|
||||
use gitbutler_core::{
|
||||
git::{self, CommitExt},
|
||||
virtual_branches::branch::{BranchCreateRequest, BranchOwnershipClaims, BranchUpdateRequest},
|
||||
};
|
||||
use gitbutler_repo::RepositoryExt;
|
||||
use gitbutler_virtual::integration;
|
||||
use gitbutler_virtual::r#virtual as virtual_branches;
|
||||
use gitbutler_virtual::r#virtual::{
|
||||
commit, create_virtual_branch, create_virtual_branch_from_branch, integrate_upstream_commits,
|
||||
is_remote_branch_mergeable, list_virtual_branches, unapply_ownership, update_branch,
|
||||
};
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use gitbutler_testsupport::{commit_all, virtual_branches::set_test_target, Case, Suite};
|
||||
@ -1303,7 +1303,7 @@ fn detect_mergeable_branch() -> Result<()> {
|
||||
};
|
||||
vb_state.set_branch(branch4.clone())?;
|
||||
|
||||
let remotes = gitbutler_branch::remote::list_remote_branches(project_repository)
|
||||
let remotes = gitbutler_virtual::remote::list_remote_branches(project_repository)
|
||||
.expect("failed to list remotes");
|
||||
let _remote1 = &remotes
|
||||
.iter()
|
@ -1,5 +1,5 @@
|
||||
use gitbutler_branch::VirtualBranch;
|
||||
use gitbutler_core::{id::Id, virtual_branches::Branch};
|
||||
use gitbutler_virtual::VirtualBranch;
|
||||
|
||||
use super::*;
|
||||
|
@ -1,10 +1,10 @@
|
||||
use std::path::PathBuf;
|
||||
use std::{fs, path, str::FromStr};
|
||||
|
||||
use gitbutler_branch::Controller;
|
||||
use gitbutler_core::error::Marker;
|
||||
use gitbutler_core::{git, virtual_branches::branch};
|
||||
use gitbutler_project::{self as projects, Project, ProjectId};
|
||||
use gitbutler_virtual::Controller;
|
||||
use tempfile::TempDir;
|
||||
|
||||
use gitbutler_testsupport::{paths, TestProject, VAR_NO_CLEANUP};
|
@ -10,7 +10,7 @@ doctest = false
|
||||
|
||||
[dependencies]
|
||||
gitbutler-core.workspace = true
|
||||
gitbutler-branch.workspace = true
|
||||
gitbutler-virtual.workspace = true
|
||||
gitbutler-sync.workspace = true
|
||||
gitbutler-oplog.workspace = true
|
||||
thiserror.workspace = true
|
||||
|
@ -1,8 +1,8 @@
|
||||
use std::fmt::Display;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use gitbutler_branch::VirtualBranches;
|
||||
use gitbutler_project::ProjectId;
|
||||
use gitbutler_virtual::VirtualBranches;
|
||||
|
||||
/// An event for internal use, as merge between [super::file_monitor::Event] and [Action].
|
||||
#[derive(Debug)]
|
||||
|
@ -2,8 +2,6 @@ use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use gitbutler_branch::assets;
|
||||
use gitbutler_branch::VirtualBranches;
|
||||
use gitbutler_command_context::ProjectRepo;
|
||||
use gitbutler_core::error::Marker;
|
||||
use gitbutler_core::git;
|
||||
@ -15,6 +13,8 @@ use gitbutler_project as projects;
|
||||
use gitbutler_project::ProjectId;
|
||||
use gitbutler_sync::cloud::sync_with_gitbutler;
|
||||
use gitbutler_user as users;
|
||||
use gitbutler_virtual::assets;
|
||||
use gitbutler_virtual::VirtualBranches;
|
||||
use tracing::instrument;
|
||||
|
||||
use super::{events, Change};
|
||||
@ -31,8 +31,8 @@ pub struct Handler {
|
||||
// need extra protection.
|
||||
projects: projects::Controller,
|
||||
users: users::Controller,
|
||||
vbranch_controller: gitbutler_branch::Controller,
|
||||
assets_proxy: gitbutler_branch::assets::Proxy,
|
||||
vbranch_controller: gitbutler_virtual::Controller,
|
||||
assets_proxy: gitbutler_virtual::assets::Proxy,
|
||||
|
||||
/// A function to send events - decoupled from app-handle for testing purposes.
|
||||
#[allow(clippy::type_complexity)]
|
||||
@ -45,7 +45,7 @@ impl Handler {
|
||||
pub fn new(
|
||||
projects: projects::Controller,
|
||||
users: users::Controller,
|
||||
vbranch_controller: gitbutler_branch::Controller,
|
||||
vbranch_controller: gitbutler_virtual::Controller,
|
||||
assets_proxy: assets::Proxy,
|
||||
send_event: impl Fn(Change) -> Result<()> + Send + Sync + 'static,
|
||||
) -> Self {
|
||||
|
Loading…
Reference in New Issue
Block a user