ui: fix crash in `hg paths` when pulled-delta-reuse-policy is in use stable
authorArseniy Alekseyev <aalekseyev@janestreet.com>
Fri, 09 Jun 2023 14:32:09 +0100
branchstable
changeset 50691 ba602ddcb296
parent 50690 ae74a60ad583
child 50692 9d4a2ea3dcb9
ui: fix crash in `hg paths` when pulled-delta-reuse-policy is in use The crash is a result of [value] being an int, but being used as a bytestring.
mercurial/commands.py
tests/test-pullling-to-general-delta.t
--- a/mercurial/commands.py	Fri Jun 09 14:31:40 2023 +0100
+++ b/mercurial/commands.py	Fri Jun 09 14:32:09 2023 +0100
@@ -5219,7 +5219,7 @@
                     value = b'yes'
                 else:
                     value = b'no'
-            fm.condwrite(showsubopts, subopt, b'%s\n', value)
+            fm.condwrite(showsubopts, subopt, b'%s\n', pycompat.bytestr(value))
 
     fm.end()
 
--- a/tests/test-pullling-to-general-delta.t	Fri Jun 09 14:31:40 2023 +0100
+++ b/tests/test-pullling-to-general-delta.t	Fri Jun 09 14:32:09 2023 +0100
@@ -178,15 +178,9 @@
 -------------------------
 
   $ cp -R client client-forced
-  $ hg -R client-forced paths --config paths.default:pulled-delta-reuse-policy=forced 2>&1 | "$PYTHON" $TESTDIR/filtertraceback.py
+  $ hg -R client-forced paths --config paths.default:pulled-delta-reuse-policy=forced
   default = $TESTTMP/server
-  default:pulled-delta-reuse-policy = ** unknown exception encountered, please report by visiting
-  ** https://mercurial-scm.org/wiki/BugTracker
-  ** Python * (glob)
-  ** Mercurial Distributed SCM (*) (glob)
-  ** Extensions loaded: 
-  Traceback (most recent call last):
-  TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'int'
+  default:pulled-delta-reuse-policy = 2
   $ hg -R client-forced pull --config paths.default:pulled-delta-reuse-policy=forced
   pulling from $TESTTMP/server
   requesting all changes