Skip to content

Commit b98ea20

Browse files
authored
Merge pull request #9408 from Byron/graph-segmentation
integration-checks
2 parents 861ffff + ff03413 commit b98ea20

File tree

28 files changed

+3411
-2415
lines changed

28 files changed

+3411
-2415
lines changed

Cargo.lock

Lines changed: 445 additions & 488 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ resolver = "2"
55
[workspace.dependencies]
66
bstr = "1.11.1"
77
# Add the `tracing` or `tracing-detail` features to see more of gitoxide in the logs. Useful to see which programs it invokes.
8-
gix = { git = "https://github.com/GitoxideLabs/gitoxide", branch = "main", version = "0.72.1", default-features = false, features = [
9-
] }
8+
gix = { version = "0.73.0", default-features = false, features = [] }
109
gix-testtools = "0.16.1"
1110
insta = "1.43.1"
1211
git2 = { version = "0.20.0", features = [

crates/but-core/src/diff/tree_changes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use crate::{ModeFlags, TreeChange};
44
use gix::diff::tree_with_rewrites::Change;
55
use gix::prelude::TreeDiffChangeExt;
66

7+
// TODO: use `peel_to_tree()` once special conflict markers aren't needed anymore.
78
fn id_to_tree(repo: &gix::Repository, id: gix::ObjectId) -> anyhow::Result<gix::Tree<'_>> {
89
let object = repo.find_object(id)?;
910
if object.kind == gix::object::Kind::Commit {

crates/but-core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ pub mod settings;
6969
pub use settings::git::types::GitConfigSettings;
7070

7171
mod repo_ext;
72-
use crate::ref_metadata::ValueInfo;
7372
pub use repo_ext::RepositoryExt;
7473

7574
/// Various types
7675
pub mod ref_metadata;
76+
use crate::ref_metadata::ValueInfo;
7777

7878
/// A trait to associate arbitrary metadata with any *Git reference name*.
7979
/// Note that a single reference name can have multiple distinct pieces of metadata associated with it.

crates/but-core/src/ref_metadata.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,27 @@ pub struct Branch {
7171

7272
impl std::fmt::Debug for Branch {
7373
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
74-
f.debug_struct("Branch")
75-
.field("ref_info", &self.ref_info)
76-
.field("description", &MaybeDebug(&self.description))
77-
.field("review", &self.review)
78-
.finish()
74+
const DEFAULT_IN_TESTSUITE: gix::date::Time = gix::date::Time {
75+
seconds: 0,
76+
offset: 0,
77+
};
78+
let mut d = f.debug_struct("Branch");
79+
if self
80+
.ref_info
81+
.created_at
82+
.is_some_and(|t| t != DEFAULT_IN_TESTSUITE)
83+
|| self
84+
.ref_info
85+
.updated_at
86+
.is_some_and(|t| t != DEFAULT_IN_TESTSUITE)
87+
|| self.description.is_some()
88+
|| self.review.pull_request.is_some()
89+
{
90+
d.field("ref_info", &self.ref_info)
91+
.field("description", &MaybeDebug(&self.description))
92+
.field("review", &self.review);
93+
}
94+
d.finish()
7995
}
8096
}
8197

crates/but-graph/src/projection/workspace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub struct Workspace<'graph> {
3939
///
4040
/// It is `None` there is only a single stack and no target, so nothing was integrated.
4141
pub lower_bound: Option<gix::ObjectId>,
42-
/// If `base` is set, this is the segment owning the commit.
42+
/// If `lower_bound` is set, this is the segment owning the commit.
4343
pub lower_bound_segment_id: Option<SegmentIndex>,
4444
/// The target to integrate workspace stacks into.
4545
///

crates/but-testing/src/args.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,6 @@ pub enum Subcommands {
205205
#[clap(long, short = 'd')]
206206
description: Option<String>,
207207
},
208-
/// Returns all commits for the branch with the given `name` in the stack with the given `id`.
209-
StackBranchCommits {
210-
id: StackId,
211-
name: String,
212-
},
213208
}
214209

215210
#[cfg(test)]

crates/but-testing/src/command/mod.rs

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,7 @@ pub mod stacks {
173173
use crate::command::{debug_print, project_from_path, ref_metadata_toml};
174174
use anyhow::Context;
175175
use but_settings::AppSettings;
176-
use but_workspace::{
177-
StacksFilter, stack_branch_local_and_remote_commits, stack_branch_upstream_only_commits,
178-
stack_branches, ui,
179-
};
176+
use but_workspace::{StacksFilter, stack_branches, ui};
180177
use gitbutler_command_context::CommandContext;
181178
use gitbutler_stack::StackId;
182179
use gix::bstr::ByteSlice;
@@ -383,34 +380,6 @@ pub mod stacks {
383380
debug_print(stack_entry)
384381
}
385382
}
386-
387-
pub fn branch_commits(
388-
id: StackId,
389-
name: &str,
390-
current_dir: &Path,
391-
use_json: bool,
392-
) -> anyhow::Result<()> {
393-
let project = project_from_path(current_dir)?;
394-
let ctx = CommandContext::open(&project, AppSettings::default())?;
395-
let repo = ctx.gix_repo()?;
396-
let local_and_remote =
397-
stack_branch_local_and_remote_commits(id, name.to_string(), &ctx, &repo);
398-
let upstream_only = stack_branch_upstream_only_commits(id, name.to_string(), &ctx, &repo);
399-
400-
if use_json {
401-
let branch_commits = BranchCommits {
402-
local_and_remote: local_and_remote?,
403-
upstream_commits: upstream_only?,
404-
};
405-
406-
let json = serde_json::to_string_pretty(&branch_commits)?;
407-
println!("{json}");
408-
Ok(())
409-
} else {
410-
debug_print(local_and_remote)?;
411-
debug_print(upstream_only)
412-
}
413-
}
414383
}
415384

416385
pub(crate) mod discard_change {

crates/but-testing/src/main.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,6 @@ async fn main() -> Result<()> {
174174
)
175175
}
176176
},
177-
args::Subcommands::StackBranchCommits { id, name } => {
178-
command::stacks::branch_commits(*id, name, &args.current_dir, args.json)
179-
}
180177
}
181178
}
182179

0 commit comments

Comments
 (0)