Mercurial > hg
changeset 7658:44b3f7bbe2f3
notify: fix neglect of custom headers set via template
e981725da3fe introduced a bug that discarded all custom headers.
Add custom header to test template.
author | Christian Ebert <blacktrash@gmx.net> |
---|---|
date | Thu, 15 Jan 2009 01:38:52 +0100 |
parents | 405cacb06745 |
children | 09b44d87dd28 |
files | hgext/notify.py tests/test-notify tests/test-notify.out |
diffstat | 3 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/notify.py Wed Jan 14 21:47:38 2009 -0500 +++ b/hgext/notify.py Thu Jan 15 01:38:52 2009 +0100 @@ -185,10 +185,16 @@ # store sender and subject sender, subject = msg['From'], msg['Subject'] + del msg['From'], msg['Subject'] + # store remaining headers + headers = msg.items() # create fresh mime message from msg body text = msg.get_payload() # for notification prefer readability over data precision msg = mail.mimeencode(self.ui, text, self.charsets, self.test) + # reinstate custom headers + for k, v in headers: + msg[k] = v def fix_subject(subject): '''try to make subject line exist and be useful.'''
--- a/tests/test-notify Wed Jan 14 21:47:38 2009 -0500 +++ b/tests/test-notify Thu Jan 15 01:38:52 2009 +0100 @@ -52,7 +52,7 @@ config = $HGTMP/.notify.conf domain = test.com strip = 3 -template = Subject: {desc|firstline|strip}\nFrom: {author}\n\nchangeset {node|short} in {webroot}\ndescription:\n\t{desc|tabindent|strip} +template = Subject: {desc|firstline|strip}\nFrom: {author}\nX-Test: foo\n\nchangeset {node|short} in {webroot}\ndescription:\n\t{desc|tabindent|strip} [web] baseurl = http://test/
--- a/tests/test-notify.out Wed Jan 14 21:47:38 2009 -0500 +++ b/tests/test-notify.out Thu Jan 15 01:38:52 2009 +0100 @@ -108,6 +108,7 @@ Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit +X-Test: foo Date: Subject: b From: test@test.com @@ -138,6 +139,7 @@ Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit +X-Test: foo Date: Subject: b From: test@test.com