Remove succeeding rebase flag from the frontend

This commit is contained in:
Caleb Owens 2024-10-07 17:31:08 +02:00
parent 531672876f
commit 2f33d618d5
8 changed files with 4 additions and 125 deletions

View File

@ -32,14 +32,6 @@ export class Project {
pullRequestTemplatePath: string;
};
private succeeding_rebases!: boolean;
get succeedingRebases() {
return this.succeeding_rebases;
}
set succeedingRebases(value) {
this.succeeding_rebases = value;
}
// Produced just for the frontend to determine if the project is open in any window.
is_open!: boolean;

View File

@ -396,7 +396,7 @@
onclick={openCommitMessageModal}>Edit message</Button
>
{/if}
{#if canEdit() && project.succeedingRebases}
{#if canEdit()}
<Button size="tag" style="ghost" outline onclick={editPatch}>
{#if conflicted}
Resolve conflicts

View File

@ -427,7 +427,7 @@
>
{/if}
{/if}
{#if canEdit() && project.succeedingRebases}
{#if canEdit()}
<Button size="tag" style="ghost" outline onclick={editPatch}>
{#if conflicted}
Resolve conflicts

View File

@ -1,11 +1,9 @@
<script lang="ts">
import IntegrateUpstreamModal from './IntegrateUpstreamModal.svelte';
import { Project } from '$lib/backend/projects';
import { BaseBranchService } from '$lib/baseBranch/baseBranchService';
import CommitAction from '$lib/commit/CommitAction.svelte';
import CommitCard from '$lib/commit/CommitCard.svelte';
import { transformAnyCommit } from '$lib/commitLines/transformers';
import { projectMergeUpstreamWarningDismissed } from '$lib/config/config';
import { getGitHost } from '$lib/gitHost/interface/gitHost';
import { ModeService } from '$lib/modes/service';
import { showInfo } from '$lib/notifications/toasts';
@ -14,7 +12,6 @@
import { getContext } from '$lib/utils/context';
import { BranchController } from '$lib/vbranches/branchController';
import Button from '@gitbutler/ui/Button.svelte';
import Checkbox from '@gitbutler/ui/Checkbox.svelte';
import Modal from '@gitbutler/ui/Modal.svelte';
import LineGroup from '@gitbutler/ui/commitLines/LineGroup.svelte';
import { LineManagerFactory, LineSpacer } from '@gitbutler/ui/commitLines/lineManager';
@ -57,13 +54,9 @@
const branchController = getContext(BranchController);
const modeService = getContext(ModeService);
const gitHost = getGitHost();
const project = getContext(Project);
const lineManagerFactory = getContext(LineManagerFactory);
const mode = $derived(modeService.mode);
const mergeUpstreamWarningDismissed = $derived(
projectMergeUpstreamWarningDismissed(branchController.projectId)
);
let baseBranchIsUpdating = $state<boolean>(false);
const baseBranchConflicted = $derived(base.conflicted);
@ -73,7 +66,6 @@
const confirmResetModalOpen = $derived(!!confirmResetModal?.imports.open);
let integrateUpstreamModal = $state<IntegrateUpstreamModal>();
const integrateUpstreamModalOpen = $derived(!!integrateUpstreamModal?.imports.open);
let mergeUpstreamWarningDismissedCheckbox = $state<boolean>(false);
const pushButtonTooltip = $derived.by(() => {
if (onlyLocalAhead) return 'Push your local changes to upstream';
@ -135,7 +127,7 @@
}
async function handleMergeUpstream() {
if (project.succeedingRebases && !onlyLocalAhead) {
if (!onlyLocalAhead) {
integrateUpstreamModal?.show();
return;
}
@ -145,10 +137,6 @@
return;
}
if ($mergeUpstreamWarningDismissed) {
updateBaseBranch();
return;
}
updateTargetModal?.show();
}
@ -352,47 +340,6 @@
</div>
</div>
<Modal
width="small"
bind:this={updateTargetModal}
title="Merge Upstream Work"
onSubmit={(close) => {
updateBaseBranch();
if (mergeUpstreamWarningDismissedCheckbox) {
mergeUpstreamWarningDismissed.set(true);
}
close();
}}
>
<div class="modal-content">
<p class="text-14 text-body">You are about to merge upstream work from your base branch.</p>
</div>
<div class="modal-content">
<h4 class="text-14 text-body text-semibold">What will this do?</h4>
<p class="modal__small-text text-12 text-body">
We will try to merge the work that is upstream into each of your virtual branches, so that
they are all up to date.
</p>
<p class="modal__small-text text-12 text-body">
Any virtual branches that we can't merge cleanly, we will unapply and mark with a blue dot.
You can merge these manually later.
</p>
<p class="modal__small-text text-12 text-body">
Any virtual branches that are fully integrated upstream will be automatically removed.
</p>
</div>
<label class="modal__dont-show-again" for="dont-show-again">
<Checkbox name="dont-show-again" bind:checked={mergeUpstreamWarningDismissedCheckbox} />
<span class="text-12">Don't show this again</span>
</label>
{#snippet controls(close)}
<Button style="ghost" outline onclick={close}>Cancel</Button>
<Button style="pop" kind="solid" type="submit">Merge Upstream</Button>
{/snippet}
</Modal>
{#if resetBaseStrategy}
<Modal
width="small"
@ -468,18 +415,4 @@
margin-bottom: 0;
}
}
.modal__small-text {
opacity: 0.6;
}
.modal__dont-show-again {
display: flex;
align-items: center;
gap: 8px;
padding: 14px;
background-color: var(--clr-bg-2);
border-radius: var(--radius-m);
margin-bottom: 6px;
}
</style>

View File

@ -1,15 +1,10 @@
<script lang="ts">
import IntegrateUpstreamModal from './IntegrateUpstreamModal.svelte';
import { Project } from '$lib/backend/projects';
import { BaseBranchService } from '$lib/baseBranch/baseBranchService';
import { showInfo } from '$lib/notifications/toasts';
import { getContext } from '$lib/utils/context';
import { BranchController } from '$lib/vbranches/branchController';
import Button from '@gitbutler/ui/Button.svelte';
const baseBranchService = getContext(BaseBranchService);
const branchController = getContext(BranchController);
const project = getContext(Project);
const base = baseBranchService.base;
@ -24,13 +19,6 @@
function openModal() {
modal?.show();
}
async function updateBaseBranch() {
let infoText = await branchController.updateBaseBranch();
if (infoText) {
showInfo('Stashed conflicting branches', infoText);
}
}
</script>
<IntegrateUpstreamModal bind:this={modal} />
@ -42,11 +30,7 @@
kind="solid"
tooltip="Merge upstream into common base"
onclick={() => {
if (project.succeedingRebases) {
openModal();
} else {
updateBaseBranch();
}
openModal();
}}
loading={modal?.imports.open}
>

View File

@ -5,11 +5,6 @@ export function projectHttpsWarningBannerDismissed(projectId: string): Persisted
return persisted(false, key + projectId);
}
export function projectMergeUpstreamWarningDismissed(projectId: string): Persisted<boolean> {
const key = 'projectMergeUpstreamWarningDismissed_';
return persisted(false, key + projectId);
}
export function projectCommitGenerationExtraConcise(projectId: string): Persisted<boolean> {
const key = 'projectCommitGenerationExtraConcise_';
return persisted(false, key + projectId);

View File

@ -50,12 +50,6 @@
let loading = true;
let signCheckResult = false;
let errorMessage = '';
let succeedingRebases = project.succeedingRebases;
$: {
project.succeedingRebases = succeedingRebases;
projectService.updateProject(project);
}
async function checkSigning() {
checked = true;

View File

@ -32,13 +32,6 @@
await projectService.updateProject(project);
}
let succeedingRebases = project.succeedingRebases;
$: {
project.succeedingRebases = succeedingRebases;
projectService.updateProject(project);
}
async function setUseNewLocking(value: boolean) {
project.use_new_locking = value;
await projectService.updateProject(project);
@ -128,16 +121,4 @@
<Toggle id="useNewLocking" bind:checked={useNewLocking} />
</svelte:fragment>
</SectionCard>
<SectionCard labelFor="succeedingRebases" orientation="row">
<svelte:fragment slot="title">Edit mode and succeeding rebases</svelte:fragment>
<svelte:fragment slot="caption">
This is an experimental setting which will ensure that rebasing will always succeed,
introduces a mode for editing individual commits, and adds the ability to resolve conflicted
commits.
</svelte:fragment>
<svelte:fragment slot="actions">
<Toggle id="succeedingRebases" bind:checked={succeedingRebases} />
</svelte:fragment>
</SectionCard>
</Section>