Skip to content

Commit 313dbdf

Browse files
committed
Delete unused v2 code (VirtualBranchService)
1 parent a7514d7 commit 313dbdf

File tree

7 files changed

+8
-321
lines changed

7 files changed

+8
-321
lines changed

apps/desktop/src/components/BaseBranchSwitch.svelte

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import InfoMessage from '$components/InfoMessage.svelte';
33
import { BaseBranch } from '$lib/baseBranch/baseBranch';
44
import BaseBranchService from '$lib/baseBranch/baseBranchService.svelte';
5-
import { VirtualBranchService } from '$lib/branches/virtualBranchService';
65
import { Project } from '$lib/project/project';
6+
import { StackService } from '$lib/stacks/stackService.svelte';
77
import { getContext } from '@gitbutler/shared/context';
88
import Button from '@gitbutler/ui/Button.svelte';
99
import SectionCard from '@gitbutler/ui/SectionCard.svelte';
@@ -13,19 +13,17 @@
1313
const project = getContext(Project);
1414
const projectId = $derived(project.id);
1515
const baseBranch = getContext(BaseBranch);
16-
const vbranchService = getContext(VirtualBranchService);
16+
const stackService = getContext(StackService);
1717
const baseBranchService = getContext(BaseBranchService);
1818
const remoteBranchesResponse = $derived(baseBranchService.remoteBranches(projectId));
19-
const activeBranches = vbranchService.branches;
2019
const [setBaseBranchTarget, targetBranchSwitch] = baseBranchService.setTarget;
2120
2221
let selectedBranch = $state({ name: baseBranch.branchName });
2322
let selectedRemote = $state({ name: baseBranch.actualPushRemoteName() });
24-
let targetChangeDisabled = $state(false);
2523
26-
if ($activeBranches) {
27-
targetChangeDisabled = $activeBranches.length > 0;
28-
}
24+
const stacksResult = $derived(stackService.stacks(projectId));
25+
const stackCount = $derived(stacksResult.current.data?.length);
26+
const targetChangeDisabled = $derived(!!(stackCount && stackCount > 0));
2927
3028
function uniqueRemotes(remoteBranches: { name: string }[]) {
3129
return Array.from(new Set(remoteBranches.map((b) => b.name.split('/')[0]))).map((r) => ({
@@ -39,7 +37,6 @@
3937
branch,
4038
pushRemote: remote
4139
});
42-
await vbranchService.refresh();
4340
}
4441
4542
async function onSetBaseBranchClick() {
@@ -109,13 +106,11 @@
109106
</Select>
110107
{/if}
111108

112-
{#if $activeBranches && targetChangeDisabled}
109+
{#if targetChangeDisabled}
113110
<InfoMessage filled outlined={false} icon="info">
114111
{#snippet content()}
115-
You have {$activeBranches.length === 1
116-
? '1 active branch'
117-
: `${$activeBranches.length} active branches`} in your workspace. Please clear the workspace
118-
before switching the base branch.
112+
You have {stackCount === 1 ? '1 active branch' : `${stackCount} active branches`} in your
113+
workspace. Please clear the workspace before switching the base branch.
119114
{/snippet}
120115
</InfoMessage>
121116
{:else}

apps/desktop/src/components/NotOnGitButlerBranch.svelte

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import RemoveProjectButton from '$components/RemoveProjectButton.svelte';
66
import directionDoubtSvg from '$lib/assets/illustrations/direction-doubt.svg?raw';
77
import BaseBranchService from '$lib/baseBranch/baseBranchService.svelte';
8-
import { VirtualBranchService } from '$lib/branches/virtualBranchService';
98
import { ModeService } from '$lib/mode/modeService';
109
import { showError } from '$lib/notifications/toasts';
1110
import { Project } from '$lib/project/project';
@@ -29,7 +28,6 @@
2928
const { baseBranch }: Props = $props();
3029
3130
const projectsService = getContext(ProjectsService);
32-
const vbranchService = getContext(VirtualBranchService);
3331
const baseBranchService = getContext(BaseBranchService);
3432
const project = getContext(Project);
3533
const [setBaseBranchTarget, targetBranchSwitch] = baseBranchService.setTarget;
@@ -48,7 +46,6 @@
4846
pushRemote: remote,
4947
stashUncommitted
5048
});
51-
await vbranchService.refresh();
5249
}
5350
5451
let isDeleting = $state(false);

apps/desktop/src/components/ProjectSetup.svelte

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import { PostHogWrapper } from '$lib/analytics/posthog';
77
import newProjectSvg from '$lib/assets/illustrations/new-project.svg?raw';
88
import BaseBranchService from '$lib/baseBranch/baseBranchService.svelte';
9-
import { VirtualBranchService } from '$lib/branches/virtualBranchService';
109
import { platformName } from '$lib/platform/platform';
1110
import { Project } from '$lib/project/project';
1211
import { ProjectsService } from '$lib/project/projectsService';
@@ -24,7 +23,6 @@
2423
const projectId = $derived(project.id);
2524
const projectsService = getContext(ProjectsService);
2625
const baseBranchService = getContext(BaseBranchService);
27-
const vbranchService = getContext(VirtualBranchService);
2826
const posthog = getContext(PostHogWrapper);
2927
const [setBaseBranchTarget] = baseBranchService.setTarget;
3028
@@ -47,7 +45,6 @@
4745
branch: selectedBranch[0],
4846
pushRemote: selectedBranch[1]
4947
});
50-
await vbranchService.refresh();
5148
goto(`/${project.id}/`, { invalidateAll: true });
5249
} finally {
5350
posthog.capture('Project Setup Complete');

apps/desktop/src/components/StackedPullRequestCard.svelte

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import MergeButton from '$components/MergeButton.svelte';
33
import PullRequestCard from '$components/PullRequestCard.svelte';
44
import BaseBranchService from '$lib/baseBranch/baseBranchService.svelte';
5-
import { VirtualBranchService } from '$lib/branches/virtualBranchService';
65
import { DefaultForgeFactory } from '$lib/forge/forgeFactory.svelte';
76
import { StackService } from '$lib/stacks/stackService.svelte';
87
import { TestId } from '$lib/testing/testIds';
@@ -20,7 +19,6 @@
2019
2120
const { projectId, stackId, branchName, prNumber }: Props = $props();
2221
23-
const vbranchService = getContext(VirtualBranchService);
2422
const baseBranchService = getContext(BaseBranchService);
2523
const forge = getContext(DefaultForgeFactory);
2624
const stackService = getContext(StackService);
@@ -85,7 +83,6 @@
8583
8684
await Promise.all([
8785
baseBranchService.fetchFromRemotes(projectId),
88-
vbranchService.refresh(),
8986
baseBranchService.refreshBaseBranch(projectId)
9087
]);
9188
}

apps/desktop/src/lib/branches/virtualBranchService.ts

Lines changed: 0 additions & 165 deletions
This file was deleted.

0 commit comments

Comments
 (0)