Patchwork D12184: dirstate-tracked-key: update the config value to match latest discussion

login
register
mail settings
Submitter phabricator
Date Feb. 15, 2022, 3:53 p.m.
Message ID <differential-rev-PHID-DREV-cj35luzn4n75gmpxf7ty-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50521/
State New
Headers show

Comments

phabricator - Feb. 15, 2022, 3:53 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12184

AFFECTED FILES
  mercurial/configitems.py
  mercurial/helptext/config.txt
  mercurial/localrepo.py
  tests/test-help.t
  tests/test-status-tracked-key.t

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-status-tracked-key.t b/tests/test-status-tracked-key.t
--- a/tests/test-status-tracked-key.t
+++ b/tests/test-status-tracked-key.t
@@ -9,7 +9,7 @@ 
 
   $ cat << EOF >> $HGRCPATH
   > [format]
-  > exp-dirstate-tracked-key-version=1
+  > dirstate-tracked-key=yes
   > EOF
 
   $ hg init tracked-key-test
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1599,7 +1599,7 @@ 
   
       "use-dirstate-v2"
   
-      "exp-dirstate-tracked-key-version"
+      "dirstate-tracked-key"
   
       "use-persistent-nodemap"
   
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -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)
 
diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt
--- a/mercurial/helptext/config.txt
+++ b/mercurial/helptext/config.txt
@@ -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),
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -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(