Patchwork [2,of,9] configitems: add a new config option to control new filenode functionality

login
register
mail settings
Submitter Pulkit Goyal
Date Sept. 23, 2020, 8:18 a.m.
Message ID <2f20d3b618ac474fd934.1600849097@workspace>
Download mbox | patch
Permalink /patch/47247/
State Accepted
Headers show

Comments

Pulkit Goyal - Sept. 23, 2020, 8:18 a.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1600074083 -19800
#      Mon Sep 14 14:31:23 2020 +0530
# Node ID 2f20d3b618ac474fd9341b86fa4f8e5791b66290
# Parent  172ab535796f7cc34ef113a73aa95eb50aaf3f31
# EXP-Topic merge-newnode
configitems: add a new config option to control new filenode functionality

This series is adding functionality where we can force create a new filenode for
some files on a merge-commit. This is meant to represent an explicit choice made
by user and hence distingusing the file in the merged commit with the file in
parent by creating a new filenode instead of using the parent one.

This introduces a experimental config option under which this functionality
will be hidden.

Differential Revision: https://phab.mercurial-scm.org/D9026
Yuya Nishihara - Sept. 24, 2020, 12:32 p.m.
On Wed, 23 Sep 2020 13:48:17 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1600074083 -19800
> #      Mon Sep 14 14:31:23 2020 +0530
> # Node ID 2f20d3b618ac474fd9341b86fa4f8e5791b66290
> # Parent  172ab535796f7cc34ef113a73aa95eb50aaf3f31
> # EXP-Topic merge-newnode
> configitems: add a new config option to control new filenode functionality

> diff --git a/tests/test-merge-criss-cross.t b/tests/test-merge-criss-cross.t
> --- a/tests/test-merge-criss-cross.t
> +++ b/tests/test-merge-criss-cross.t
> @@ -486,6 +486,14 @@ Following test cases demonstrate how mer
>  explicit choices made by users to revert the removal and on criss-cross merging
>  removes the file again.
>  
> +Enable the config option
> +------------------------
> +
> +  $ cat >> $HGRCPATH <<EOF
> +  > [experimental]
> +  > merge-track-salvaged = True
> +  > EOF

If the differences are manageable, using "#testcases" will be better. We'll
probably need to test that this option doesn't break other scenarios.

Patch

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -590,6 +590,11 @@  coreconfigitem(
 coreconfigitem(
     b'experimental', b'maxdeltachainspan', default=-1,
 )
+# tracks files which were undeleted (merge might delete them but we explicitly
+# kept/undeleted them) and creates new filenodes for them
+coreconfigitem(
+    b'experimental', b'merge-track-salvaged', default=False,
+)
 coreconfigitem(
     b'experimental', b'mergetempdirprefix', default=None,
 )
diff --git a/tests/test-merge-criss-cross.t b/tests/test-merge-criss-cross.t
--- a/tests/test-merge-criss-cross.t
+++ b/tests/test-merge-criss-cross.t
@@ -486,6 +486,14 @@  Following test cases demonstrate how mer
 explicit choices made by users to revert the removal and on criss-cross merging
 removes the file again.
 
+Enable the config option
+------------------------
+
+  $ cat >> $HGRCPATH <<EOF
+  > [experimental]
+  > merge-track-salvaged = True
+  > EOF
+
 "Simple" case where the filenode changes
 ----------------------------------------