# HG changeset patch # User Christian Ebert # Date 1231979932 -3600 # Node ID af4871b73be720d1d488aca51ba151b08fabb0da # Parent 876de22b70b87b558b2c1c2e301a881ced4df400 notify: fix neglect of custom headers set via template e981725da3fe introduced a bug that discarded all custom headers. Add custom header to test template. diff -r 876de22b70b8 -r af4871b73be7 hgext/notify.py --- a/hgext/notify.py Mon Jan 19 12:36:06 2009 +0100 +++ 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.''' diff -r 876de22b70b8 -r af4871b73be7 tests/test-notify --- a/tests/test-notify Mon Jan 19 12:36:06 2009 +0100 +++ 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/ diff -r 876de22b70b8 -r af4871b73be7 tests/test-notify.out --- a/tests/test-notify.out Mon Jan 19 12:36:06 2009 +0100 +++ 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