Hunk locking: Remove the experimental flag

Move fully to the new Hunk Locking algorithm, remove the references to that flag and the settings UI
This commit is contained in:
estib 2024-11-04 09:52:58 +01:00
parent ce87969c06
commit f1b0dccbe6
6 changed files with 2 additions and 46 deletions

View File

@ -27,7 +27,6 @@ export class Project {
omit_certificate_check: boolean | undefined;
use_diff_context: boolean | undefined;
snapshot_lines_threshold!: number | undefined;
use_experimental_locking!: boolean;
// Produced just for the frontend to determine if the project is open in any window.
is_open!: boolean;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { GitConfigService } from '$lib/backend/gitConfigService';
import { Project, ProjectsService } from '$lib/backend/projects';
import { Project } from '$lib/backend/projects';
import SectionCard from '$lib/components/SectionCard.svelte';
import SectionCardDisclaimer from '$lib/components/SectionCardDisclaimer.svelte';
import Select from '$lib/select/Select.svelte';
@ -15,10 +15,8 @@
import { invoke } from '@tauri-apps/api/core';
import { onMount } from 'svelte';
const projectsService = getContext(ProjectsService);
const project = getContext(Project);
let useNewLocking = project?.use_experimental_locking || false;
let signCommits = false;
const gitConfig = getContext(GitConfigService);
@ -78,13 +76,6 @@
await gitConfig.setGbConfig(project.id, signUpdate);
}
async function setUseNewLocking(value: boolean) {
project.use_experimental_locking = value;
await projectsService.updateProject(project);
}
$: setUseNewLocking(useNewLocking);
onMount(async () => {
let gitConfigSettings = await gitConfig.getGbConfig(project.id);
signCommits = gitConfigSettings.signCommits || false;

View File

@ -13,7 +13,6 @@
let snaphotLinesThreshold = project?.snapshot_lines_threshold || 20; // when undefined, the default is 20
let omitCertificateCheck = project?.omit_certificate_check;
let useNewLocking = project?.use_experimental_locking || false;
const runCommitHooks = projectRunCommitHooks(project.id);
@ -27,13 +26,6 @@
await projectsService.updateProject(project);
}
async function setUseNewLocking(value: boolean) {
project.use_experimental_locking = value;
await projectsService.updateProject(project);
}
$: setUseNewLocking(useNewLocking);
async function handleOmitCertificateCheckClick(event: MouseEvent) {
await setOmitCertificateCheck((event.target as HTMLInputElement)?.checked);
}
@ -86,15 +78,4 @@
/>
</svelte:fragment>
</SectionCard>
<SectionCard labelFor="useNewLocking" orientation="row">
<svelte:fragment slot="title">Use new experimental hunk locking algorithm</svelte:fragment>
<svelte:fragment slot="caption">
This new hunk locking algorithm is still in the testing phase but should more accurately catch
locks and subsequently cause fewer errors.
</svelte:fragment>
<svelte:fragment slot="actions">
<Toggle id="useNewLocking" bind:checked={useNewLocking} />
</svelte:fragment>
</SectionCard>
</Section>

View File

@ -30,11 +30,9 @@ impl Default for Test {
let projects = projects::Controller::from_path(data_dir.path());
let test_project = TestProject::default();
let mut project = projects
let project = projects
.add(test_project.path())
.expect("failed to add project");
// TODO: Remove after transition is complete.
project.use_experimental_locking = true;
Self {
repository: test_project,

View File

@ -94,14 +94,6 @@ pub struct Project {
pub omit_certificate_check: Option<bool>,
// The number of changed lines that will trigger a snapshot
pub snapshot_lines_threshold: Option<usize>,
// Experimental flag for new hunk dependency algorithm
#[serde(default = "default_true")]
pub use_experimental_locking: bool,
}
// TODO: Remove after `use_experimental` has been removed.
fn default_true() -> bool {
true
}
impl Project {

View File

@ -27,7 +27,6 @@ pub struct UpdateRequest {
pub omit_certificate_check: Option<bool>,
pub use_diff_context: Option<bool>,
pub snapshot_lines_threshold: Option<usize>,
pub use_experimental_locking: Option<bool>,
}
impl Storage {
@ -124,10 +123,6 @@ impl Storage {
project.snapshot_lines_threshold = Some(snapshot_lines_threshold);
}
if let Some(use_experimental_locking) = &update_request.use_experimental_locking {
project.use_experimental_locking = *use_experimental_locking;
}
self.inner
.write(PROJECTS_FILE, &serde_json::to_string_pretty(&projects)?)?;