path: display proper user facing value for pulled-delta-reuse-policy stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 15 Jun 2023 09:51:29 +0200
branchstable
changeset 50693 c96fd53c0e2d
parent 50692 9d4a2ea3dcb9
child 50694 e9c676ad18f1
path: display proper user facing value for pulled-delta-reuse-policy The integer was not what the user expect nor what could be provided as a config value.
mercurial/utils/urlutil.py
tests/test-pullling-to-general-delta.t
--- a/mercurial/utils/urlutil.py	Thu Jun 15 09:50:46 2023 +0200
+++ b/mercurial/utils/urlutil.py	Thu Jun 15 09:51:29 2023 +0200
@@ -746,9 +746,14 @@
     b'no-reuse': revlog_constants.DELTA_BASE_REUSE_NO,
     b'forced': revlog_constants.DELTA_BASE_REUSE_FORCE,
 }
+DELTA_REUSE_POLICIES_NAME = dict(i[::-1] for i in DELTA_REUSE_POLICIES.items())
 
 
-@pathsuboption(b'pulled-delta-reuse-policy', b'delta_reuse_policy')
+@pathsuboption(
+    b'pulled-delta-reuse-policy',
+    b'delta_reuse_policy',
+    display=DELTA_REUSE_POLICIES_NAME.get,
+)
 def delta_reuse_policy(ui, path, value):
     if value not in DELTA_REUSE_POLICIES:
         path_name = path.name
--- a/tests/test-pullling-to-general-delta.t	Thu Jun 15 09:50:46 2023 +0200
+++ b/tests/test-pullling-to-general-delta.t	Thu Jun 15 09:51:29 2023 +0200
@@ -180,7 +180,7 @@
   $ cp -R client client-forced
   $ hg -R client-forced paths --config paths.default:pulled-delta-reuse-policy=forced
   default = $TESTTMP/server
-  default:pulled-delta-reuse-policy = 2
+  default:pulled-delta-reuse-policy = forced
   $ hg -R client-forced pull --config paths.default:pulled-delta-reuse-policy=forced
   pulling from $TESTTMP/server
   requesting all changes