D3952: patchbomb: ensure all headers and values given to email mod are native strings

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Wed Aug 1 17:18:35 UTC 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG65ed2fcb9032: patchbomb: ensure all headers and values given to email mod are native strings (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3952?vs=9608&id=9714

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

AFFECTED FILES
  hgext/patchbomb.py

CHANGE DETAILS

diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -780,6 +780,16 @@
             m['Bcc'] = ', '.join(bcc)
         if replyto:
             m['Reply-To'] = ', '.join(replyto)
+        # Fix up all headers to be native strings.
+        # TODO(durin42): this should probably be cleaned up above in the future.
+        if pycompat.ispy3:
+            for hdr, val in list(m.items()):
+                if isinstance(hdr, bytes):
+                    del m[hdr]
+                    hdr = pycompat.strurl(hdr)
+                if isinstance(val, bytes):
+                    val = pycompat.strurl(val)
+                m[hdr] = val
         if opts.get('test'):
             ui.status(_('displaying '), subj, ' ...\n')
             ui.pager('email')



To: durin42, #hg-reviewers, indygreg
Cc: mercurial-devel


More information about the Mercurial-devel mailing list