Skip to content

Commit 0317278

Browse files
committed
Don't use an outcome status for now
1 parent 42cf963 commit 0317278

File tree

4 files changed

+48
-47
lines changed

4 files changed

+48
-47
lines changed

crates/but-rebase/src/graph_rebase/rebase.rs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@ pub struct SuccessfulRebase {
3131
pub(crate) checkouts: Vec<Checkouts>,
3232
}
3333

34-
/// Represents the rebase output and the varying degrees of success it had.
35-
#[derive(Debug, Clone)]
36-
#[expect(clippy::large_enum_variant)]
37-
#[must_use = "Rebase does nothing to affect the commit graph unless materialized"]
38-
pub enum RebaseOutcome {
39-
/// The rebase
40-
Success(SuccessfulRebase),
41-
/// The graph rebase failed because we encountered a situation where we
42-
/// couldn't merge bases.
43-
///
44-
/// Holds the gix::ObjectId of the commit it failed to pick
45-
MergePickFailed(gix::ObjectId),
46-
}
34+
// /// Represents the rebase output and the varying degrees of success it had.
35+
// #[derive(Debug, Clone)]
36+
// #[expect(clippy::large_enum_variant)]
37+
// #[must_use = "Rebase does nothing to affect the commit graph unless materialized"]
38+
// pub enum RebaseOutcome {
39+
// /// The rebase
40+
// Success(SuccessfulRebase),
41+
// /// The graph rebase failed because we encountered a situation where we
42+
// /// couldn't merge bases.
43+
// ///
44+
// /// Holds the gix::ObjectId of the commit it failed to pick
45+
// MergePickFailed(gix::ObjectId),
46+
// }
4747

4848
impl Editor {
4949
/// Perform the rebase
50-
pub fn rebase(self) -> Result<RebaseOutcome> {
50+
pub fn rebase(self) -> Result<SuccessfulRebase> {
5151
// First we want to get a list of nodes that can be reached by
5252
// traversing downwards from the heads that we care about.
5353
// Usually there would be just one "head" which is an index to access
@@ -115,7 +115,8 @@ impl Editor {
115115
}
116116
CherryPickOutcome::FailedToMergeBases => {
117117
// Exit early - the rebase failed because it encountered a commit it couldn't pick
118-
return Ok(RebaseOutcome::MergePickFailed(id));
118+
// return Ok(RebaseOutcome::MergePickFailed(id));
119+
bail!("Failed to merge bases for commit {id}");
119120
}
120121
}
121122
}
@@ -214,14 +215,14 @@ impl Editor {
214215
}
215216
}
216217

217-
Ok(RebaseOutcome::Success(SuccessfulRebase {
218+
Ok(SuccessfulRebase {
218219
repo: self.repo,
219220
ref_edits,
220221
commit_mapping,
221222
graph_mapping,
222223
graph: output_graph,
223224
checkouts: self.checkouts.to_owned(),
224-
}))
225+
})
225226
}
226227
}
227228

crates/but-rebase/tests/rebase/graph_rebase/insert.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! These tests exercise the insert operation.
2-
use anyhow::{Context, Result, bail};
2+
use anyhow::{Context, Result};
33
use but_graph::Graph;
4-
use but_rebase::graph_rebase::{GraphExt, Step, mutate::InsertSide, rebase::RebaseOutcome};
4+
use but_rebase::graph_rebase::{GraphExt, Step, mutate::InsertSide};
55
use but_testsupport::{git_status, visualize_commit_graph_all};
66

77
use crate::{
@@ -54,9 +54,9 @@ fn insert_below_merge_commit() -> Result<()> {
5454
);
5555

5656
let outcome = editor.rebase()?;
57-
let RebaseOutcome::Success(outcome) = outcome else {
58-
bail!("Rebase failed");
59-
};
57+
// let RebaseOutcome::Success(outcome) = outcome else {
58+
// bail!("Rebase failed");
59+
// };
6060
outcome.materialize()?;
6161

6262
insta::assert_snapshot!(visualize_commit_graph_all(&repo)?, @r"
@@ -120,9 +120,9 @@ fn insert_above_commit_with_two_children() -> Result<()> {
120120
);
121121

122122
let outcome = editor.rebase()?;
123-
let RebaseOutcome::Success(outcome) = outcome else {
124-
bail!("Rebase failed");
125-
};
123+
// let RebaseOutcome::Success(outcome) = outcome else {
124+
// bail!("Rebase failed");
125+
// };
126126
outcome.materialize()?;
127127

128128
insta::assert_snapshot!(visualize_commit_graph_all(&repo)?, @r"

crates/but-rebase/tests/rebase/graph_rebase/rebase_identities.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/// These tests demonstrate that if none of the steps are changed, the same
22
/// graphs are returned.
3-
use anyhow::{Result, bail};
3+
use anyhow::Result;
44
use but_graph::Graph;
5-
use but_rebase::graph_rebase::{GraphExt, rebase::RebaseOutcome};
5+
use but_rebase::graph_rebase::GraphExt;
66
use but_testsupport::{graph_workspace, visualize_commit_graph_all};
77

88
use crate::utils::{fixture_writable, standard_options};
@@ -23,9 +23,9 @@ fn four_commits() -> Result<()> {
2323

2424
let editor = graph.to_editor(&repo)?;
2525
let outcome = editor.rebase()?;
26-
let RebaseOutcome::Success(outcome) = outcome else {
27-
bail!("Rebase failed");
28-
};
26+
// let RebaseOutcome::Success(outcome) = outcome else {
27+
// bail!("Rebase failed");
28+
// };
2929
outcome.materialize()?;
3030

3131
assert_eq!(visualize_commit_graph_all(&repo)?, before);
@@ -59,9 +59,9 @@ fn four_commits_with_short_traversal() -> Result<()> {
5959

6060
let editor = graph.to_editor(&repo)?;
6161
let outcome = editor.rebase()?;
62-
let RebaseOutcome::Success(outcome) = outcome else {
63-
bail!("Rebase failed");
64-
};
62+
// let RebaseOutcome::Success(outcome) = outcome else {
63+
// bail!("Rebase failed");
64+
// };
6565
outcome.materialize()?;
6666

6767
assert_eq!(visualize_commit_graph_all(&repo)?, before);
@@ -88,9 +88,9 @@ fn merge_in_the_middle() -> Result<()> {
8888

8989
let editor = graph.to_editor(&repo)?;
9090
let outcome = editor.rebase()?;
91-
let RebaseOutcome::Success(outcome) = outcome else {
92-
bail!("Rebase failed");
93-
};
91+
// let RebaseOutcome::Success(outcome) = outcome else {
92+
// bail!("Rebase failed");
93+
// };
9494
outcome.materialize()?;
9595

9696
assert_eq!(visualize_commit_graph_all(&repo)?, before);
@@ -121,9 +121,9 @@ fn three_branches_merged() -> Result<()> {
121121

122122
let editor = graph.to_editor(&repo)?;
123123
let outcome = editor.rebase()?;
124-
let RebaseOutcome::Success(outcome) = outcome else {
125-
bail!("Rebase failed");
126-
};
124+
// let RebaseOutcome::Success(outcome) = outcome else {
125+
// bail!("Rebase failed");
126+
// };
127127
outcome.materialize()?;
128128

129129
assert_eq!(visualize_commit_graph_all(&repo)?, before);

crates/but-rebase/tests/rebase/graph_rebase/replace.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! These tests exercise the replace operation.
2-
use anyhow::{Context, Result, bail};
2+
use anyhow::{Context, Result};
33
use but_graph::Graph;
4-
use but_rebase::graph_rebase::{GraphExt, Step, rebase::RebaseOutcome};
4+
use but_rebase::graph_rebase::{GraphExt, Step};
55
use but_testsupport::{git_status, visualize_commit_graph_all, visualize_tree};
66

77
use crate::{
@@ -55,9 +55,9 @@ fn reword_a_commit() -> Result<()> {
5555
);
5656

5757
let outcome = editor.rebase()?;
58-
let RebaseOutcome::Success(outcome) = outcome else {
59-
bail!("Rebase failed");
60-
};
58+
// let RebaseOutcome::Success(outcome) = outcome else {
59+
// bail!("Rebase failed");
60+
// };
6161
outcome.materialize()?;
6262

6363
assert_eq!(head_tree, repo.head_tree()?.id);
@@ -139,9 +139,9 @@ fn ammend_a_commit() -> Result<()> {
139139
);
140140

141141
let outcome = editor.rebase()?;
142-
let RebaseOutcome::Success(outcome) = outcome else {
143-
bail!("Rebase failed");
144-
};
142+
// let RebaseOutcome::Success(outcome) = outcome else {
143+
// bail!("Rebase failed");
144+
// };
145145
outcome.materialize()?;
146146

147147
insta::assert_snapshot!(visualize_commit_graph_all(&repo)?, @r"

0 commit comments

Comments
 (0)