changeset 48771:79a967128055

dirstate-tracked-key: update the config value to match latest discussion Special cases are not special enough, we align the option name on the other. The `version` value is undocumented for now as it can only have a single value. It is supported in the code to properly detect and abort if more value are introduced in the future value. Differential Revision: https://phab.mercurial-scm.org/D12184
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 15 Feb 2022 05:20:46 +0100
parents f19be290756a
children b70c9697ab41
files mercurial/configitems.py mercurial/helptext/config.txt mercurial/localrepo.py tests/test-help.t tests/test-status-tracked-key.t
diffstat 5 files changed, 18 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/configitems.py	Fri Nov 26 15:38:04 2021 +0100
+++ b/mercurial/configitems.py	Tue Feb 15 05:20:46 2022 +0100
@@ -1284,8 +1284,14 @@
 )
 coreconfigitem(
     b'format',
-    b'exp-dirstate-tracked-key-version',
-    default=0,
+    b'dirstate-tracked-key',
+    default=False,
+    experimental=True,
+)
+coreconfigitem(
+    b'format',
+    b'dirstate-tracked-key.version',
+    default=1,
     experimental=True,
 )
 coreconfigitem(
--- a/mercurial/helptext/config.txt	Fri Nov 26 15:38:04 2021 +0100
+++ b/mercurial/helptext/config.txt	Tue Feb 15 05:20:46 2022 +0100
@@ -944,16 +944,13 @@
 
     For a more comprehensive guide, see :hg:`help internals.dirstate-v2`.
 
-``exp-dirstate-tracked-key-version``
+``dirstate-tracked-key``
     Enable or disable the writing of "tracked key" file alongside the dirstate.
+    (default to disabled)
 
     That "tracked-key" can help external automations to detect changes to the
     set of tracked files.
 
-    Two values are currently supported:
-    - 0: no file is written (the default),
-    - 1: a file in version "1" is written.
-
     The tracked-key is written in a new `.hg/dirstate-tracked-key`. That file
     contains two lines:
     - the first line is the file version (currently: 1),
--- a/mercurial/localrepo.py	Fri Nov 26 15:38:04 2021 +0100
+++ b/mercurial/localrepo.py	Tue Feb 15 05:20:46 2022 +0100
@@ -3695,14 +3695,12 @@
         else:
             requirements.add(requirementsmod.SHARED_REQUIREMENT)
 
-    tracked_key = ui.configint(b'format', b'exp-dirstate-tracked-key-version')
-    if tracked_key:
-        if tracked_key != 1:
-            msg = _("ignoring unknown tracked key version: %d\n")
-            hint = _(
-                "see `hg help config.format.exp-dirstate-tracked-key-version"
-            )
-            ui.warn(msg % tracked_key, hint=hint)
+    if ui.configbool(b'format', b'dirstate-tracked-key'):
+        version = ui.configint(b'format', b'dirstate-tracked-key.version')
+        msg = _("ignoring unknown tracked key version: %d\n")
+        hint = _("see `hg help config.format.exp-dirstate-tracked-key-version")
+        if version != 1:
+            ui.warn(msg % version, hint=hint)
         else:
             requirements.add(requirementsmod.DIRSTATE_TRACKED_KEY_V1)
 
--- a/tests/test-help.t	Fri Nov 26 15:38:04 2021 +0100
+++ b/tests/test-help.t	Tue Feb 15 05:20:46 2022 +0100
@@ -1599,7 +1599,7 @@
   
       "use-dirstate-v2"
   
-      "exp-dirstate-tracked-key-version"
+      "dirstate-tracked-key"
   
       "use-persistent-nodemap"
   
--- a/tests/test-status-tracked-key.t	Fri Nov 26 15:38:04 2021 +0100
+++ b/tests/test-status-tracked-key.t	Tue Feb 15 05:20:46 2022 +0100
@@ -9,7 +9,7 @@
 
   $ cat << EOF >> $HGRCPATH
   > [format]
-  > exp-dirstate-tracked-key-version=1
+  > dirstate-tracked-key=yes
   > EOF
 
   $ hg init tracked-key-test