Skip to content

Commit 2683bcb

Browse files
authored
Merge pull request #10282 from Byron/next
V3 apply/unapply: safe checkout
2 parents 89a8a66 + 491f133 commit 2683bcb

File tree

20 files changed

+1141
-383
lines changed

20 files changed

+1141
-383
lines changed

apps/desktop/cypress/e2e/support/mock/settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const MOCK_TELEMETRY_SETINGS: TelemetrySettings = {
88
};
99

1010
export const MOCK_FEATURE_FLAGS: FeatureFlags = {
11+
cv3: false,
1112
ws3: false,
1213
actions: false,
1314
butbot: false,

apps/desktop/src/lib/config/appSettingsV2.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ export type TelemetrySettings = {
158158
};
159159

160160
export type FeatureFlags = {
161+
/** Enable everything next-gen checkout */
162+
cv3: boolean;
161163
/** Enable the usage of the V3 workspace API */
162164
ws3: boolean;
163165
/** Enable the usage of GitButler Acitions. */

apps/desktop/src/routes/+layout.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@
124124
'w s 3': () => {
125125
settingsService.updateFeatureFlags({ ws3: !$settingsStore?.featureFlags.ws3 });
126126
},
127+
// Toggle next-gen safe checkout.
128+
'c o 3': () => {
129+
settingsService.updateFeatureFlags({ cv3: !$settingsStore?.featureFlags.cv3 });
130+
},
127131
// Show commit graph visualization
128132
'd o t': async () => {
129133
const projectId = page.params.projectId;

crates/but-claude/src/bridge.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ async fn spawn_command(
342342
.mcp_servers_with_security()
343343
.exclude(&disabled_mcp_servers),
344344
)?;
345-
dbg!(&mcp_config);
346345
let mut command = Command::new(claude_executable);
347346

348347
/// Don't create a terminal window on windows.

crates/but-settings/assets/defaults.jsonc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
"oauthClientId": "cd51880daa675d9e6452"
1919
},
2020
"featureFlags": {
21-
// Enables the v3 design, as well as the purgatory mode (no uncommitted diff ownership assignments).
21+
// Deprecated, was used for the new version of the UI.
2222
"v3": false,
23+
// Enables the v3 safe checkout.
24+
"cv3": false,
2325
/// Enable the usage of V3 workspace APIs.
2426
"ws3": false,
2527
/// Enable undo/redo support.

crates/but-settings/src/api.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub struct TelemetryUpdate {
1515
#[serde(rename_all = "camelCase")]
1616
/// Update request for [`crate::app_settings::FeatureFlags`].
1717
pub struct FeatureFlagsUpdate {
18+
pub cv3: Option<bool>,
1819
pub ws3: Option<bool>,
1920
pub actions: Option<bool>,
2021
pub butbot: Option<bool>,
@@ -65,6 +66,7 @@ impl AppSettingsWithDiskSync {
6566
pub fn update_feature_flags(
6667
&self,
6768
FeatureFlagsUpdate {
69+
cv3,
6870
ws3,
6971
actions,
7072
butbot,
@@ -73,6 +75,9 @@ impl AppSettingsWithDiskSync {
7375
}: FeatureFlagsUpdate,
7476
) -> Result<()> {
7577
let mut settings = self.get_mut_enforce_save()?;
78+
if let Some(cv3) = cv3 {
79+
settings.feature_flags.cv3 = cv3;
80+
}
7681
if let Some(ws3) = ws3 {
7782
settings.feature_flags.ws3 = ws3;
7883
}

crates/but-settings/src/app_settings.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ pub struct FeatureFlags {
2626
/// Enable the usage of V3 workspace APIs.
2727
#[serde(default = "default_true")]
2828
pub ws3: bool,
29+
/// Turn on the set a v3 version of checkout
30+
pub cv3: bool,
2931
/// Enable undo/redo support.
3032
///
3133
/// ### Progression for implementation

crates/but-testing/src/args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ pub enum Subcommands {
147147
/// As StackIDs are going away, BranchDetails would be the part that remains.
148148
StackDetails {
149149
/// The ID of the stack to list details for.
150-
id: StackId,
150+
id: Option<StackId>,
151151
},
152152
/// Returns detailed
153153
BranchDetails {

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,19 @@ pub mod stacks {
196196
}
197197
}
198198

199-
pub fn details(id: StackId, current_dir: &Path, v3: bool) -> anyhow::Result<()> {
199+
pub fn details(id: Option<StackId>, current_dir: &Path, v3: bool) -> anyhow::Result<()> {
200200
let project = project_from_path(current_dir)?;
201201
let ctx = CommandContext::open(&project, AppSettings::default())?;
202202
let details = if v3 {
203203
let meta = ref_metadata_toml(ctx.project())?;
204204
let repo = ctx.gix_repo_for_merging_non_persisting()?;
205-
but_workspace::stack_details_v3(id.into(), &repo, &meta)
205+
but_workspace::stack_details_v3(id, &repo, &meta)
206206
} else {
207-
but_workspace::stack_details(&project.gb_dir(), id, &ctx)
207+
but_workspace::stack_details(
208+
&project.gb_dir(),
209+
id.context("a StackID is needed for the old implementation")?,
210+
&ctx,
211+
)
208212
}?;
209213
debug_print(details)
210214
}
@@ -334,6 +338,7 @@ pub mod stacks {
334338
let app_settings = AppSettings {
335339
feature_flags: but_settings::app_settings::FeatureFlags {
336340
ws3,
341+
cv3: false,
337342
undo: false,
338343
actions: false,
339344
butbot: false,

0 commit comments

Comments
 (0)