upgrade: byteify requirement changes written to output
ui.write() expects bytes, and internally uses `b''` as the default when getting
the `label` keyword from `*args`. So either we're missing test coverage, or
there's some very subtle conversion from unicode somewhere.
Also, slip in a type hint to flag this in the future.
--- a/mercurial/upgrade_utils/actions.py Thu Nov 03 16:30:35 2022 +0100
+++ b/mercurial/upgrade_utils/actions.py Sun Nov 06 12:15:35 2022 -0500
@@ -852,7 +852,7 @@
return False
- def _write_labeled(self, l, label):
+ def _write_labeled(self, l, label: bytes):
"""
Utility function to aid writing of a list under one label
"""
@@ -867,19 +867,19 @@
self.ui.write(_(b'requirements\n'))
self.ui.write(_(b' preserved: '))
self._write_labeled(
- self._preserved_requirements, "upgrade-repo.requirement.preserved"
+ self._preserved_requirements, b"upgrade-repo.requirement.preserved"
)
self.ui.write((b'\n'))
if self._removed_requirements:
self.ui.write(_(b' removed: '))
self._write_labeled(
- self._removed_requirements, "upgrade-repo.requirement.removed"
+ self._removed_requirements, b"upgrade-repo.requirement.removed"
)
self.ui.write((b'\n'))
if self._added_requirements:
self.ui.write(_(b' added: '))
self._write_labeled(
- self._added_requirements, "upgrade-repo.requirement.added"
+ self._added_requirements, b"upgrade-repo.requirement.added"
)
self.ui.write((b'\n'))
self.ui.write(b'\n')
@@ -893,7 +893,7 @@
self.ui.write(_(b'optimisations: '))
self._write_labeled(
[a.name for a in optimisations],
- "upgrade-repo.optimisation.performed",
+ b"upgrade-repo.optimisation.performed",
)
self.ui.write(b'\n\n')