hgext/patchbomb.py
changeset 39035 cecb05c371f7
parent 39034 751caa6a2936
child 39038 2161faf0d24b
--- a/hgext/patchbomb.py	Thu Aug 09 19:37:57 2018 -0400
+++ b/hgext/patchbomb.py	Thu Aug 09 19:39:33 2018 -0400
@@ -789,12 +789,19 @@
         # TODO(durin42): this should probably be cleaned up above in the future.
         if pycompat.ispy3:
             for hdr, val in list(m.items()):
+                change = False
                 if isinstance(hdr, bytes):
                     del m[hdr]
                     hdr = pycompat.strurl(hdr)
+                    change = True
                 if isinstance(val, bytes):
                     val = pycompat.strurl(val)
-                m[hdr] = val
+                    if not change:
+                        # prevent duplicate headers
+                        del m[hdr]
+                    change = True
+                if change:
+                    m[hdr] = val
         if opts.get('test'):
             ui.status(_('displaying '), subj, ' ...\n')
             ui.pager('email')