changeset 44604:2141427533d2 stable

py3: require values in changelog extras to be bytes I don't know what happened here because b436059c1cca (py3: use pycompat.bytestr() on extra values because it can be int, 2019-02-05) came about b44a47214122 (py3: use string for "close" value in commit extras, 2018-02-11). Whatever happened, we shouldn't need to convert the values to bytes now. It's better to not convert because that might cover up bugs where someone sets a unicode value in the extras and that works until the unicode value happens to contain non-ascii (at which point it will fail because `bytestr()` expects its argument to be ascii if it's unicode). Differential Revision: https://phab.mercurial-scm.org/D8332
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 25 Mar 2020 18:50:40 -0700
parents bda050bc9987
children 8fca7e8449a8
files mercurial/changelog.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changelog.py	Wed Mar 25 18:25:58 2020 -0700
+++ b/mercurial/changelog.py	Wed Mar 25 18:50:40 2020 -0700
@@ -82,10 +82,7 @@
 
 def encodeextra(d):
     # keys must be sorted to produce a deterministic changelog entry
-    items = [
-        _string_escape(b'%s:%s' % (k, pycompat.bytestr(d[k])))
-        for k in sorted(d)
-    ]
+    items = [_string_escape(b'%s:%s' % (k, d[k])) for k in sorted(d)]
     return b"\0".join(items)