D8332: py3: require values in changelog extras to be bytes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

D8332: py3: require values in changelog extras to be bytes

martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I don't know what happened here because b436059c1cca <https://phab.mercurial-scm.org/rHGb436059c1cca85ec327889a8fba17837e5c7b8e6> (py3: use
  pycompat.bytestr() on extra values because it can be int, 2019-02-05)
  came about b44a47214122 <https://phab.mercurial-scm.org/rHGb44a4721412228aec4fde226bef594f4691ea61f> (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).

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8332

AFFECTED FILES
  mercurial/changelog.py

CHANGE DETAILS

diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -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)
 
 



To: martinvonz, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D8332: py3: require values in changelog extras to be bytes

martinvonz (Martin von Zweigbergk)
Closed by commit rHG2141427533d2: py3: require values in changelog extras to be bytes (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8332?vs=20887&id=20889

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8332/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8332

AFFECTED FILES
  mercurial/changelog.py

CHANGE DETAILS

diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -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)
 
 



To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel