Default to experimental locking

- changing the name of the field since existing projects would have an explicit false value already
This commit is contained in:
Mattias Granlund 2024-10-28 17:29:24 +01:00
parent 6759d3e4dc
commit 4b77cf4074
7 changed files with 17 additions and 12 deletions

View File

@ -29,7 +29,7 @@ export class Project {
omit_certificate_check: boolean | undefined;
use_diff_context: boolean | undefined;
snapshot_lines_threshold!: number | undefined;
use_new_locking!: boolean;
use_experimental_locking!: boolean;
git_host!: {
hostType: HostType | undefined;
reviewTemplatePath: string | undefined;

View File

@ -18,7 +18,7 @@
const projectsService = getContext(ProjectsService);
const project = getContext(Project);
let useNewLocking = project?.use_new_locking || false;
let useNewLocking = project?.use_experimental_locking || false;
let signCommits = false;
const gitConfig = getContext(GitConfigService);
@ -78,7 +78,7 @@
}
async function setUseNewLocking(value: boolean) {
project.use_new_locking = value;
project.use_experimental_locking = value;
await projectsService.updateProject(project);
}

View File

@ -13,7 +13,7 @@
let snaphotLinesThreshold = project?.snapshot_lines_threshold || 20; // when undefined, the default is 20
let omitCertificateCheck = project?.omit_certificate_check;
let useNewLocking = project?.use_new_locking || false;
let useNewLocking = project?.use_experimental_locking || false;
const runCommitHooks = projectRunCommitHooks(project.id);
@ -28,7 +28,7 @@
}
async function setUseNewLocking(value: boolean) {
project.use_new_locking = value;
project.use_experimental_locking = value;
await projectsService.updateProject(project);
}

View File

@ -98,7 +98,7 @@ pub fn get_applied_status_cached(
let vb_state = ctx.project().virtual_branches();
let default_target = vb_state.get_default_target()?;
let locks = if ctx.project().use_new_locking {
let locks = if ctx.project().use_experimental_locking {
compute_locks(
ctx,
&workspace_head,

View File

@ -34,7 +34,7 @@ impl Default for Test {
.add(test_project.path())
.expect("failed to add project");
// TODO: Remove after transition is complete.
project.use_new_locking = true;
project.use_experimental_locking = true;
Self {
repository: test_project,

View File

@ -98,8 +98,13 @@ pub struct Project {
#[serde(default)]
pub git_host: GitHostSettings,
// Experimental flag for new hunk dependency algorithm
#[serde(default)]
pub use_new_locking: bool,
#[serde(default = "default_true")]
pub use_experimental_locking: bool,
}
// TODO: Remove after `use_experimental` has been removed.
fn default_true() -> bool {
true
}
#[derive(Debug, Deserialize, Serialize, Clone, Default)]

View File

@ -28,7 +28,7 @@ pub struct UpdateRequest {
pub use_diff_context: Option<bool>,
pub snapshot_lines_threshold: Option<usize>,
pub git_host: Option<GitHostSettings>,
pub use_new_locking: Option<bool>,
pub use_experimental_locking: Option<bool>,
}
impl Storage {
@ -129,8 +129,8 @@ impl Storage {
project.git_host = git_host.clone();
}
if let Some(use_new_locking) = &update_request.use_new_locking {
project.use_new_locking = *use_new_locking;
if let Some(use_experimental_locking) = &update_request.use_experimental_locking {
project.use_experimental_locking = *use_experimental_locking;
}
self.inner