mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-22 09:01:45 +03:00
Refactor - join stack and stack api crates
Separation was previously needed due to cycle dependency with the repo crate. The stack_ext is to be refactored as an impl on stack
This commit is contained in:
parent
5b5f9b2e45
commit
ccec1868f8
29
Cargo.lock
generated
29
Cargo.lock
generated
@ -2192,7 +2192,6 @@ dependencies = [
|
||||
"gitbutler-repo-actions",
|
||||
"gitbutler-serde",
|
||||
"gitbutler-stack",
|
||||
"gitbutler-stack-api",
|
||||
"gitbutler-testsupport",
|
||||
"gitbutler-time",
|
||||
"gitbutler-url",
|
||||
@ -2316,7 +2315,6 @@ dependencies = [
|
||||
"gitbutler-reference",
|
||||
"gitbutler-repo",
|
||||
"gitbutler-stack",
|
||||
"gitbutler-stack-api",
|
||||
"gitbutler-time",
|
||||
"serde",
|
||||
]
|
||||
@ -2584,43 +2582,26 @@ version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"git2",
|
||||
"gitbutler-command-context",
|
||||
"gitbutler-commit",
|
||||
"gitbutler-diff",
|
||||
"gitbutler-error",
|
||||
"gitbutler-fs",
|
||||
"gitbutler-id",
|
||||
"gitbutler-patch-reference",
|
||||
"gitbutler-reference",
|
||||
"gitbutler-serde",
|
||||
"gitbutler-time",
|
||||
"gix",
|
||||
"itertools 0.13.0",
|
||||
"serde",
|
||||
"toml 0.8.19",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gitbutler-stack-api"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"git2",
|
||||
"gitbutler-branch",
|
||||
"gitbutler-command-context",
|
||||
"gitbutler-commit",
|
||||
"gitbutler-git",
|
||||
"gitbutler-id",
|
||||
"gitbutler-patch-reference",
|
||||
"gitbutler-reference",
|
||||
"gitbutler-repo",
|
||||
"gitbutler-repo-actions",
|
||||
"gitbutler-stack",
|
||||
"gitbutler-serde",
|
||||
"gitbutler-testsupport",
|
||||
"gitbutler-time",
|
||||
"gix",
|
||||
"gix-utils 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itertools 0.13.0",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
"tempfile",
|
||||
"toml 0.8.19",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
|
@ -33,7 +33,6 @@ members = [
|
||||
"crates/gitbutler-edit-mode",
|
||||
"crates/gitbutler-cherry-pick",
|
||||
"crates/gitbutler-oxidize",
|
||||
"crates/gitbutler-stack-api",
|
||||
"crates/gitbutler-stack",
|
||||
"crates/gitbutler-patch-reference",
|
||||
]
|
||||
@ -91,7 +90,6 @@ gitbutler-operating-modes = { path = "crates/gitbutler-operating-modes" }
|
||||
gitbutler-edit-mode = { path = "crates/gitbutler-edit-mode" }
|
||||
gitbutler-cherry-pick = { path = "crates/gitbutler-cherry-pick" }
|
||||
gitbutler-oxidize = { path = "crates/gitbutler-oxidize" }
|
||||
gitbutler-stack-api = { path = "crates/gitbutler-stack-api" }
|
||||
gitbutler-stack = { path = "crates/gitbutler-stack" }
|
||||
gitbutler-patch-reference = { path = "crates/gitbutler-patch-reference" }
|
||||
gitbutler-forge = { path = "crates/gitbutler-forge" }
|
||||
|
@ -29,7 +29,6 @@ gitbutler-operating-modes.workspace = true
|
||||
gitbutler-cherry-pick.workspace = true
|
||||
gitbutler-oxidize.workspace = true
|
||||
gitbutler-stack.workspace = true
|
||||
gitbutler-stack-api.workspace = true
|
||||
gitbutler-patch-reference.workspace = true
|
||||
serde = { workspace = true, features = ["std"] }
|
||||
bstr.workspace = true
|
||||
|
@ -8,8 +8,8 @@ use gitbutler_project::FetchResult;
|
||||
use gitbutler_reference::{Refname, RemoteRefname};
|
||||
use gitbutler_repo::{LogUntil, RepositoryExt};
|
||||
use gitbutler_repo_actions::RepoActionsExt;
|
||||
use gitbutler_stack::StackExt;
|
||||
use gitbutler_stack::{BranchOwnershipClaims, Stack, Target, VirtualBranchesHandle};
|
||||
use gitbutler_stack_api::StackExt;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::{
|
||||
|
@ -13,8 +13,8 @@ use gitbutler_repo::{
|
||||
LogUntil, RepositoryExt,
|
||||
};
|
||||
use gitbutler_repo_actions::RepoActionsExt;
|
||||
use gitbutler_stack::StackExt;
|
||||
use gitbutler_stack::{BranchOwnershipClaims, Stack, StackId};
|
||||
use gitbutler_stack_api::StackExt;
|
||||
use gitbutler_time::time::now_since_unix_epoch_ms;
|
||||
use tracing::instrument;
|
||||
|
||||
|
@ -6,7 +6,7 @@ use gitbutler_repo::{
|
||||
LogUntil, RepositoryExt as _,
|
||||
};
|
||||
use gitbutler_stack::StackId;
|
||||
use gitbutler_stack_api::{commit_by_oid_or_change_id, StackExt};
|
||||
use gitbutler_stack::{commit_by_oid_or_change_id, StackExt};
|
||||
|
||||
use crate::{
|
||||
branch_trees::{
|
||||
|
@ -12,8 +12,8 @@ use gitbutler_operating_modes::OPEN_WORKSPACE_REFS;
|
||||
use gitbutler_project::access::WorktreeWritePermission;
|
||||
use gitbutler_repo::SignaturePurpose;
|
||||
use gitbutler_repo::{LogUntil, RepositoryExt};
|
||||
use gitbutler_stack::StackExt;
|
||||
use gitbutler_stack::{Stack, VirtualBranchesHandle};
|
||||
use gitbutler_stack_api::StackExt;
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::{branch_manager::BranchManagerExt, conflicts, VirtualBranchesExt};
|
||||
|
@ -7,8 +7,8 @@ use gitbutler_command_context::CommandContext;
|
||||
use gitbutler_commit::commit_ext::CommitExt;
|
||||
use gitbutler_project::access::WorktreeWritePermission;
|
||||
use gitbutler_repo::{rebase::cherry_rebase_group, LogUntil, RepositoryExt};
|
||||
use gitbutler_stack::StackExt;
|
||||
use gitbutler_stack::{OwnershipClaim, StackId};
|
||||
use gitbutler_stack_api::StackExt;
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// moves commit from the branch it's in to the top of the target branch
|
||||
|
@ -2,8 +2,8 @@ use anyhow::{bail, Context as _, Result};
|
||||
use gitbutler_command_context::CommandContext;
|
||||
use gitbutler_project::access::WorktreeWritePermission;
|
||||
use gitbutler_repo::{rebase::cherry_rebase_group, LogUntil, RepositoryExt as _};
|
||||
use gitbutler_stack::StackExt;
|
||||
use gitbutler_stack::StackId;
|
||||
use gitbutler_stack_api::StackExt;
|
||||
|
||||
use crate::{
|
||||
branch_trees::{
|
||||
|
@ -7,10 +7,8 @@ use gitbutler_commit::commit_ext::CommitExt;
|
||||
use gitbutler_patch_reference::{CommitOrChangeId, PatchReference};
|
||||
use gitbutler_project::Project;
|
||||
use gitbutler_repo_actions::RepoActionsExt;
|
||||
use gitbutler_stack::{commit_by_oid_or_change_id, CommitsForId, PatchReferenceUpdate, StackExt};
|
||||
use gitbutler_stack::{Stack, StackId, Target};
|
||||
use gitbutler_stack_api::{
|
||||
commit_by_oid_or_change_id, CommitsForId, PatchReferenceUpdate, StackExt,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
|
@ -15,8 +15,8 @@ use gitbutler_command_context::CommandContext;
|
||||
use gitbutler_diff::{diff_files_into_hunks, GitHunk, Hunk, HunkHash};
|
||||
use gitbutler_operating_modes::assure_open_workspace_mode;
|
||||
use gitbutler_project::access::WorktreeWritePermission;
|
||||
use gitbutler_stack::StackExt;
|
||||
use gitbutler_stack::{BranchOwnershipClaims, OwnershipClaim, Stack, StackId};
|
||||
use gitbutler_stack_api::StackExt;
|
||||
use tracing::instrument;
|
||||
|
||||
/// Represents the uncommitted status of the applied virtual branches in the workspace.
|
||||
|
@ -2,8 +2,8 @@ use anyhow::{bail, Context as _, Result};
|
||||
use gitbutler_command_context::CommandContext;
|
||||
use gitbutler_commit::commit_ext::CommitExt as _;
|
||||
use gitbutler_repo::{rebase::cherry_rebase_group, LogUntil, RepositoryExt as _};
|
||||
use gitbutler_stack::StackExt;
|
||||
use gitbutler_stack::{Stack, StackId};
|
||||
use gitbutler_stack_api::StackExt;
|
||||
|
||||
use crate::VirtualBranchesExt as _;
|
||||
|
||||
|
@ -7,8 +7,8 @@ use gitbutler_repo::{
|
||||
LogUntil, RepositoryExt as _,
|
||||
};
|
||||
use gitbutler_repo_actions::RepoActionsExt as _;
|
||||
use gitbutler_stack::StackExt;
|
||||
use gitbutler_stack::{Stack, StackId, Target, VirtualBranchesHandle};
|
||||
use gitbutler_stack_api::StackExt;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
|
@ -28,10 +28,10 @@ use gitbutler_repo::{
|
||||
LogUntil, RepositoryExt,
|
||||
};
|
||||
use gitbutler_repo_actions::RepoActionsExt;
|
||||
use gitbutler_stack::StackExt;
|
||||
use gitbutler_stack::{
|
||||
reconcile_claims, BranchOwnershipClaims, Stack, StackId, Target, VirtualBranchesHandle,
|
||||
};
|
||||
use gitbutler_stack_api::StackExt;
|
||||
use gitbutler_time::time::now_since_unix_epoch_ms;
|
||||
use serde::Serialize;
|
||||
use std::collections::HashSet;
|
||||
|
@ -20,8 +20,8 @@ use gitbutler_branch_actions::{
|
||||
use gitbutler_commit::{commit_ext::CommitExt, commit_headers::CommitHeadersV2};
|
||||
use gitbutler_reference::{Refname, RemoteRefname};
|
||||
use gitbutler_repo::RepositoryExt;
|
||||
use gitbutler_stack::StackExt;
|
||||
use gitbutler_stack::{BranchOwnershipClaims, Target, VirtualBranchesHandle};
|
||||
use gitbutler_stack_api::StackExt;
|
||||
use gitbutler_testsupport::{commit_all, virtual_branches::set_test_target, Case, Suite};
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
|
@ -22,5 +22,4 @@ gitbutler-oplog.workspace = true
|
||||
gitbutler-diff.workspace = true
|
||||
gitbutler-stack.workspace = true
|
||||
gitbutler-cherry-pick.workspace = true
|
||||
gitbutler-stack-api.workspace = true
|
||||
serde.workspace = true
|
||||
|
@ -25,8 +25,8 @@ use gitbutler_project::access::{WorktreeReadPermission, WorktreeWritePermission}
|
||||
use gitbutler_reference::{ReferenceName, Refname};
|
||||
use gitbutler_repo::{rebase::cherry_rebase, RepositoryExt};
|
||||
use gitbutler_repo::{signature, SignaturePurpose};
|
||||
use gitbutler_stack::StackExt;
|
||||
use gitbutler_stack::{Stack, VirtualBranchesHandle};
|
||||
use gitbutler_stack_api::StackExt;
|
||||
use serde::Serialize;
|
||||
|
||||
pub mod commands;
|
||||
|
@ -1,34 +0,0 @@
|
||||
[package]
|
||||
name = "gitbutler-stack-api"
|
||||
version = "0.0.0"
|
||||
edition = "2021"
|
||||
authors = ["GitButler <gitbutler@gitbutler.com>"]
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.86"
|
||||
itertools = "0.13"
|
||||
rand = "0.8.5"
|
||||
gix-utils = "0.1.12"
|
||||
serde = { workspace = true, features = ["std"] }
|
||||
git2.workspace = true
|
||||
gix.workspace = true
|
||||
tracing.workspace = true
|
||||
gitbutler-command-context.workspace = true
|
||||
gitbutler-branch.workspace = true
|
||||
gitbutler-patch-reference.workspace = true
|
||||
gitbutler-reference.workspace = true
|
||||
gitbutler-repo.workspace = true
|
||||
gitbutler-commit.workspace = true
|
||||
gitbutler-time.workspace = true
|
||||
gitbutler-stack.workspace = true
|
||||
|
||||
[[test]]
|
||||
name = "stack-api"
|
||||
path = "tests/mod.rs"
|
||||
|
||||
[dev-dependencies]
|
||||
gitbutler-git = { workspace = true, features = ["test-askpass-path"] }
|
||||
gitbutler-testsupport.workspace = true
|
||||
gitbutler-repo-actions.workspace = true
|
||||
tempfile = "3.13"
|
@ -1,7 +0,0 @@
|
||||
mod heads;
|
||||
mod series;
|
||||
mod stack_ext;
|
||||
pub use series::Series;
|
||||
pub use stack_ext::{
|
||||
commit_by_oid_or_change_id, CommitsForId, PatchReferenceUpdate, StackExt, TargetUpdate,
|
||||
};
|
File diff suppressed because it is too large
Load Diff
@ -8,10 +8,12 @@ publish = false
|
||||
[dependencies]
|
||||
git2.workspace = true
|
||||
gix = { workspace = true, features = [] }
|
||||
gix-utils = "0.1.12"
|
||||
itertools = "0.13"
|
||||
anyhow = "1.0.86"
|
||||
serde = { workspace = true, features = ["std"] }
|
||||
toml.workspace = true
|
||||
tracing.workspace = true
|
||||
gitbutler-patch-reference.workspace = true
|
||||
gitbutler-reference.workspace = true
|
||||
gitbutler-id.workspace = true
|
||||
@ -20,7 +22,16 @@ gitbutler-time.workspace = true
|
||||
gitbutler-diff.workspace = true
|
||||
gitbutler-error.workspace = true
|
||||
gitbutler-fs.workspace = true
|
||||
gitbutler-command-context.workspace = true
|
||||
gitbutler-repo.workspace = true
|
||||
gitbutler-commit.workspace = true
|
||||
|
||||
[[test]]
|
||||
name = "branch"
|
||||
name = "stack"
|
||||
path = "tests/mod.rs"
|
||||
|
||||
[dev-dependencies]
|
||||
gitbutler-git = { workspace = true, features = ["test-askpass-path"] } # Runtime test dependency
|
||||
gitbutler-testsupport.workspace = true
|
||||
gitbutler-repo-actions.workspace = true
|
||||
tempfile = "3.13"
|
||||
|
@ -9,3 +9,11 @@ pub use ownership::{reconcile_claims, BranchOwnershipClaims, ClaimOutcome};
|
||||
pub use stack::{Stack, StackId};
|
||||
pub use state::{VirtualBranches as VirtualBranchesState, VirtualBranchesHandle};
|
||||
pub use target::Target;
|
||||
|
||||
mod heads;
|
||||
mod series;
|
||||
mod stack_ext;
|
||||
pub use series::Series;
|
||||
pub use stack_ext::{
|
||||
commit_by_oid_or_change_id, CommitsForId, PatchReferenceUpdate, StackExt, TargetUpdate,
|
||||
};
|
||||
|
@ -1,5 +1,7 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use crate::Stack;
|
||||
use crate::VirtualBranchesHandle;
|
||||
use anyhow::anyhow;
|
||||
use anyhow::bail;
|
||||
use anyhow::Context;
|
||||
@ -13,8 +15,6 @@ use gitbutler_reference::Refname;
|
||||
use gitbutler_reference::RemoteRefname;
|
||||
use gitbutler_repo::LogUntil;
|
||||
use gitbutler_repo::RepositoryExt;
|
||||
use gitbutler_stack::Stack;
|
||||
use gitbutler_stack::VirtualBranchesHandle;
|
||||
use gix::validate::reference::name_partial;
|
||||
use gix_utils::str::decompose;
|
||||
use itertools::Itertools;
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user