changeset 50718:0ab3956540a6

branching: merge stable into default
author Raphaël Gomès <rgomes@octobus.net>
date Thu, 22 Jun 2023 11:28:17 +0200
parents e5c1e7aec973 (current diff) 41b9eb302d95 (diff)
children 9a4db474ef1a 0a55206c5a1e
files mercurial/commands.py mercurial/debugcommands.py mercurial/utils/urlutil.py
diffstat 8 files changed, 45 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsigs	Wed Jun 21 14:00:50 2023 -0400
+++ b/.hgsigs	Thu Jun 22 11:28:17 2023 +0200
@@ -245,3 +245,4 @@
 f952be90b0514a576dcc8bbe758ce3847faba9bb 0 iQHNBAABCgA3FiEEH2b4zfZU6QXBHaBhoR4BzQ4F2VYFAmQ+ZaoZHGFscGhhcmVAcmFwaGFlbGdvbWVzLmRldgAKCRChHgHNDgXZVuDOC/90SQ3UjXmByAaT5qr4bd3sVGt12lXlaKdyDxY0JMSKyHMUnb4YltHzNFxiUku10aRsRvJt5denTGeaOvAYbbXE7nbZJuyLD9rvfFTCe6EVx7kymCBwSbobKMzD79QHAFU7xu036gs7rmwyc++F4JF4IOrT4bjSYY5/8g0uLAHUexnn49QfQ5OYr325qShDFLjUZ7aH0yxA/gEr2MfXQmbIEc0eJJQXD1EhDkpSJFNIKzwWMOT1AhFk8kTlDqqbPnW7sDxTW+v/gGjAFYLHi8GMLEyrBQdEqytN7Pl9XOPXt/8RaDfIzYfl0OHxh2l1Y1MuH/PHrWO4PBPsr82QI2mxufYKuujpFMPr4PxXXl2g31OKhI8jJj+bHr62kGIOJCxZ8EPPGKXPGyoOuIVa0MeHmXxjb9kkj0SALjlaUvZrSENzRTsQXDNHQa+iDaITKLmItvLsaTEz9DJzGmI20shtJYcx4lqHsTgtMZfOtR5tmUknAFUUBZfUwvwULD4LmNI=
 fc445f8abcf90b33db7c463816a1b3560681767f 0 iQHNBAABCgA3FiEEH2b4zfZU6QXBHaBhoR4BzQ4F2VYFAmRTok8ZHGFscGhhcmVAcmFwaGFlbGdvbWVzLm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5mJvTDQYBo/zjLyvKFEbnSLzhEP+9SvthCrtX0UYkKxOGi2M2Z7e9wgBB0gY8a36kA739lkNu6r3vH/FVh0aPTMWukLToELS90WgfViNr16lDnCeDjMgg97OKxWdOW6U=
+271a4ab29605ffa0bae5d3208eaa21a95427ff92 0 iQHNBAABCgA3FiEEH2b4zfZU6QXBHaBhoR4BzQ4F2VYFAmSUEeMZHGFscGhhcmVAcmFwaGFlbGdvbWVzLmRldgAKCRChHgHNDgXZVlJnC/98qGmpi0gHbsoCPfoxgV2uSE4XAXZXPvbHqKAVUVJbkQoS0L2jighUArPZsduRjD+nSf/jO951/DmnxIwXfF5qA2dP1eBnjSmXS3xslmqD7nUw+pP8mKUQvXky+AbiL5onWw4gRtsqTZg4DYnPMeaE/eIUy/j60kXsf6gaDkQSAF/+9vB5UcVI1z7gKY/nE5pGW6cS9kPd/BEg2icficaOHXcetQFi53Gcy5kLEaYc9f8RUrvc0Z9jDkZSlmTHfTLOY+1hlFZ2FRAvL1Ikh7Ks+85LWuqs1ZYIdB6ucudhLW1dGd/ZyD0iU82e0XrU/tm6oDBdeSFOy1AAXN5pern18VcPeaT/zGgN7DG1LW9jISbYFzLwvHwzTMKSVgq4HSfeTHiSKoWp0qAbcFHUYfC4L1Heqd/UfzVN/1/9eSj69Hbjff8+E6OOF15Ky2gtr8PSyP7WIu9rTueUUoWIMG99btq5OYvEbmWgHuHIcJBUEJOalvhrZePbTW3v22Eh45M=
--- a/.hgtags	Wed Jun 21 14:00:50 2023 -0400
+++ b/.hgtags	Thu Jun 22 11:28:17 2023 +0200
@@ -261,3 +261,4 @@
 f952be90b0514a576dcc8bbe758ce3847faba9bb 6.4.2
 fc445f8abcf90b33db7c463816a1b3560681767f 6.4.3
 da372c745e0f053bb7a64e74cccd15810d96341d 6.4.4
+271a4ab29605ffa0bae5d3208eaa21a95427ff92 6.4.5
--- a/mercurial/commands.py	Wed Jun 21 14:00:50 2023 -0400
+++ b/mercurial/commands.py	Thu Jun 22 11:28:17 2023 +0200
@@ -5222,11 +5222,8 @@
             assert subopt not in (b'name', b'url')
             if showsubopts:
                 fm.plain(b'%s:%s = ' % (name, subopt))
-            if isinstance(value, bool):
-                if value:
-                    value = b'yes'
-                else:
-                    value = b'no'
+            display = urlutil.path_suboptions_display[subopt]
+            value = display(value)
             fm.condwrite(showsubopts, subopt, b'%s\n', value)
 
     fm.end()
--- a/mercurial/debugcommands.py	Wed Jun 21 14:00:50 2023 -0400
+++ b/mercurial/debugcommands.py	Thu Jun 22 11:28:17 2023 +0200
@@ -2146,7 +2146,7 @@
         ),
     )
     re2 = b'missing'
-    if util._re2:
+    if util.has_re2():
         re2 = b'available'
     fm.plain(_(b'checking "re2" regexp engine (%s)\n') % re2)
     fm.data(re2=bool(util._re2))
--- a/mercurial/util.py	Wed Jun 21 14:00:50 2023 -0400
+++ b/mercurial/util.py	Thu Jun 22 11:28:17 2023 +0200
@@ -2210,10 +2210,21 @@
     _re2 = False
 
 
+def has_re2():
+    """return True is re2 is available, False otherwise"""
+    if _re2 is None:
+        _re._checkre2()
+    return _re2
+
+
 class _re:
-    def _checkre2(self):
+    @staticmethod
+    def _checkre2():
         global _re2
         global _re2_input
+        if _re2 is not None:
+            # we already have the answer
+            return
 
         check_pattern = br'\[([^\[]+)\]'
         check_input = b'[ui]'
--- a/mercurial/utils/urlutil.py	Wed Jun 21 14:00:50 2023 -0400
+++ b/mercurial/utils/urlutil.py	Thu Jun 22 11:28:17 2023 +0200
@@ -658,9 +658,11 @@
 
 
 _pathsuboptions = {}
+# a dictionnary of methods that can be used to format a sub-option value
+path_suboptions_display = {}
 
 
-def pathsuboption(option, attr):
+def pathsuboption(option, attr, display=pycompat.bytestr):
     """Decorator used to declare a path sub-option.
 
     Arguments are the sub-option name and the attribute it should set on
@@ -671,17 +673,26 @@
     The function should return the value that will be set on the ``path``
     instance.
 
+    The optional `display` argument is a function that can be used to format
+    the value when displayed to the user (like in `hg paths` for example).
+
     This decorator can be used to perform additional verification of
     sub-options and to change the type of sub-options.
     """
 
     def register(func):
         _pathsuboptions[option] = (attr, func)
+        path_suboptions_display[option] = display
         return func
 
     return register
 
 
+def display_bool(value):
+    """display a boolean suboption back to the user"""
+    return b'yes' if value else b'no'
+
+
 @pathsuboption(b'pushurl', b'_pushloc')
 def pushurlpathoption(ui, path, value):
     u = url(value)
@@ -740,9 +751,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
@@ -757,7 +773,7 @@
     return DELTA_REUSE_POLICIES.get(value)
 
 
-@pathsuboption(b'multi-urls', b'multi_urls')
+@pathsuboption(b'multi-urls', b'multi_urls', display=display_bool)
 def multiurls_pathoption(ui, path, value):
     res = stringutil.parsebool(value)
     if res is None:
--- a/relnotes/6.4	Wed Jun 21 14:00:50 2023 -0400
+++ b/relnotes/6.4	Thu Jun 22 11:28:17 2023 +0200
@@ -1,3 +1,9 @@
+= Mercurial 6.4.5 =
+
+ * re2: fix reporting of availability in `hg debuginstall`
+ * ui: fix crash in `hg paths` when pulled-delta-reuse-policy is in use
+ * path: display proper user facing value for pulled-delta-reuse-policy
+
 = Mercurial 6.4.4 =
 
  * clonebundles: filter out invalid schemes instead of failing on them
--- a/tests/test-pullling-to-general-delta.t	Wed Jun 21 14:00:50 2023 -0400
+++ b/tests/test-pullling-to-general-delta.t	Thu Jun 22 11:28:17 2023 +0200
@@ -178,6 +178,9 @@
 -------------------------
 
   $ 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 = forced
   $ hg -R client-forced pull --config paths.default:pulled-delta-reuse-policy=forced
   pulling from $TESTTMP/server
   requesting all changes