This dict-like of headers is only mostly dict-like: if you set a key
that already exists, you it appends another value, rather than
replacing the one that was already present.
This fixes test-patchbomb-bookmark.t on Python 3.
| pulkit | |
| indygreg |
| hg-reviewers |
This dict-like of headers is only mostly dict-like: if you set a key
that already exists, you it appends another value, rather than
replacing the one that was already present.
This fixes test-patchbomb-bookmark.t on Python 3.
| Lint Skipped |
| Unit Tests Skipped |
Eww. But I got nothing better that doesn't involve reconstructing the message instance :/
| Path | Packages | |||
|---|---|---|---|---|
| M | contrib/python3-whitelist (1 line) | |||
| M | hgext/patchbomb.py (9 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| Augie Fackler | Aug 9 2018, 7:39 PM |
| test-obsolete-distributed.t | test-obsolete-distributed.t | ||||
| test-obsolete-divergent.t | test-obsolete-divergent.t | ||||
| test-obsolete-tag-cache.t | test-obsolete-tag-cache.t | ||||
| test-pager.t | test-pager.t | ||||
| test-parents.t | test-parents.t | ||||
| test-parseindex2.py | test-parseindex2.py | ||||
| test-patch-offset.t | test-patch-offset.t | ||||
| test-patch.t | test-patch.t | ||||
| test-patchbomb-bookmark.t | |||||
| test-patchbomb-tls.t | test-patchbomb-tls.t | ||||
| test-pathconflicts-merge.t | test-pathconflicts-merge.t | ||||
| test-pathconflicts-update.t | test-pathconflicts-update.t | ||||
| test-pathencode.py | test-pathencode.py | ||||
| test-pending.t | test-pending.t | ||||
| test-permissions.t | test-permissions.t | ||||
| test-phases.t | test-phases.t | ||||
| test-pull-branch.t | test-pull-branch.t | ||||
| if bcc: | if bcc: | ||||
| m['Bcc'] = ', '.join(bcc) | m['Bcc'] = ', '.join(bcc) | ||||
| if replyto: | if replyto: | ||||
| m['Reply-To'] = ', '.join(replyto) | m['Reply-To'] = ', '.join(replyto) | ||||
| # Fix up all headers to be native strings. | # Fix up all headers to be native strings. | ||||
| # TODO(durin42): this should probably be cleaned up above in the future. | # TODO(durin42): this should probably be cleaned up above in the future. | ||||
| if pycompat.ispy3: | if pycompat.ispy3: | ||||
| for hdr, val in list(m.items()): | for hdr, val in list(m.items()): | ||||
| change = False | |||||
| if isinstance(hdr, bytes): | if isinstance(hdr, bytes): | ||||
| del m[hdr] | del m[hdr] | ||||
| hdr = pycompat.strurl(hdr) | hdr = pycompat.strurl(hdr) | ||||
| change = True | |||||
| if isinstance(val, bytes): | if isinstance(val, bytes): | ||||
| val = pycompat.strurl(val) | val = pycompat.strurl(val) | ||||
| if not change: | |||||
| # prevent duplicate headers | |||||
| del m[hdr] | |||||
| change = True | |||||
| if change: | |||||
| m[hdr] = val | m[hdr] = val | ||||
| if opts.get('test'): | if opts.get('test'): | ||||
| ui.status(_('displaying '), subj, ' ...\n') | ui.status(_('displaying '), subj, ' ...\n') | ||||
| ui.pager('email') | ui.pager('email') | ||||
| generator = emailgen.Generator(_bytesgenerator(ui), | generator = emailgen.Generator(_bytesgenerator(ui), | ||||
| mangle_from_=False) | mangle_from_=False) | ||||
| try: | try: | ||||
| generator.flatten(m, 0) | generator.flatten(m, 0) | ||||
| ui.write('\n') | ui.write('\n') | ||||