Show More
@@ -82,6 +82,12 b' notify.strip' | |||
|
82 | 82 | |
|
83 | 83 | notify.domain |
|
84 | 84 | Default email domain for sender or recipients with no explicit domain. |
|
85 | It is also used for the domain part of the ``Message-Id`` when using | |
|
86 | ``notify.messageidseed``. | |
|
87 | ||
|
88 | notify.messageidseed | |
|
89 | Create deterministic ``Message-Id`` headers for the mails based on the seed | |
|
90 | and the revision identifier of the first commit in the changeset. | |
|
85 | 91 | |
|
86 | 92 | notify.style |
|
87 | 93 | Style file to use when formatting emails. |
@@ -144,6 +150,7 b' from __future__ import absolute_import' | |||
|
144 | 150 | import email.errors as emailerrors |
|
145 | 151 | import email.parser as emailparser |
|
146 | 152 | import fnmatch |
|
153 | import hashlib | |
|
147 | 154 | import socket |
|
148 | 155 | import time |
|
149 | 156 | |
@@ -183,6 +190,9 b" configitem('notify', 'diffstat'," | |||
|
183 | 190 | configitem('notify', 'domain', |
|
184 | 191 | default=None, |
|
185 | 192 | ) |
|
193 | configitem('notify', 'messageidseed', | |
|
194 | default=None, | |
|
195 | ) | |
|
186 | 196 | configitem('notify', 'fromauthor', |
|
187 | 197 | default=None, |
|
188 | 198 | ) |
@@ -268,6 +278,7 b' class notifier(object):' | |||
|
268 | 278 | self.subs = self.subscribers() |
|
269 | 279 | self.merge = self.ui.configbool('notify', 'merge') |
|
270 | 280 | self.showfunc = self.ui.configbool('notify', 'showfunc') |
|
281 | self.messageidseed = self.ui.config('notify', 'messageidseed') | |
|
271 | 282 | if self.showfunc is None: |
|
272 | 283 | self.showfunc = self.ui.configbool('diff', 'showfunc') |
|
273 | 284 | |
@@ -412,10 +423,7 b' class notifier(object):' | |||
|
412 | 423 | |
|
413 | 424 | msg[r'X-Hg-Notification'] = r'changeset %s' % ctx |
|
414 | 425 | if not msg[r'Message-Id']: |
|
415 | msg[r'Message-Id'] = encoding.strfromlocal( | |
|
416 | '<hg.%s.%d.%d@%s>' % (ctx, int(time.time()), | |
|
417 | hash(self.repo.root), | |
|
418 | encoding.strtolocal(socket.getfqdn()))) | |
|
426 | msg[r'Message-Id'] = messageid(ctx, self.domain, self.messageidseed) | |
|
419 | 427 | msg[r'To'] = encoding.strfromlocal(', '.join(sorted(subs))) |
|
420 | 428 | |
|
421 | 429 | msgtext = encoding.strtolocal(msg.as_string()) |
@@ -517,3 +525,16 b' def hook(ui, repo, hooktype, node=None, ' | |||
|
517 | 525 | |
|
518 | 526 | if count: |
|
519 | 527 | n.send(ctx, count, data) |
|
528 | ||
|
529 | def messageid(ctx, domain, messageidseed): | |
|
530 | if domain and messageidseed: | |
|
531 | host = domain | |
|
532 | else: | |
|
533 | host = encoding.strtolocal(socket.getfqdn()) | |
|
534 | if messageidseed: | |
|
535 | messagehash = hashlib.sha512(ctx.hex() + messageidseed) | |
|
536 | messageid = '<hg.%s@%s>' % (messagehash.hexdigest()[:64], host) | |
|
537 | else: | |
|
538 | messageid = '<hg.%s.%d.%d@%s>' % (ctx, int(time.time()), | |
|
539 | hash(ctx.repo().root), host) | |
|
540 | return encoding.strfromlocal(messageid) |
@@ -99,7 +99,13 b'' | |||
|
99 | 99 | "/long/path/repository" into "repository". Default: 0. |
|
100 | 100 | |
|
101 | 101 | notify.domain |
|
102 | Default email domain for sender or recipients with no explicit domain. | |
|
102 | Default email domain for sender or recipients with no explicit domain. It is | |
|
103 | also used for the domain part of the "Message-Id" when using | |
|
104 | "notify.messageidseed". | |
|
105 | ||
|
106 | notify.messageidseed | |
|
107 | Create deterministic "Message-Id" headers for the mails based on the seed | |
|
108 | and the revision identifier of the first commit in the changeset. | |
|
103 | 109 | |
|
104 | 110 | notify.style |
|
105 | 111 | Style file to use when formatting emails. |
@@ -190,7 +196,7 b' the python call below wraps continuation' | |||
|
190 | 196 | of the very long subject line |
|
191 | 197 | pull (minimal config) |
|
192 | 198 | |
|
193 | $ hg --traceback --cwd b pull ../a | "$PYTHON" $TESTTMP/filter.py | |
|
199 | $ hg --traceback --cwd b --config notify.domain=example.com --config notify.messageidseed=example pull ../a | "$PYTHON" $TESTTMP/filter.py | |
|
194 | 200 | pulling from ../a |
|
195 | 201 | searching for changes |
|
196 | 202 | adding changesets |
@@ -203,10 +209,10 b' pull (minimal config)' | |||
|
203 | 209 | Content-Transfer-Encoding: 7bit |
|
204 | 210 | Date: * (glob) |
|
205 | 211 | Subject: changeset in $TESTTMP/b: b |
|
206 | From: test | |
|
212 | From: test@example.com | |
|
207 | 213 | X-Hg-Notification: changeset 00a13f371396 |
|
208 | Message-Id: <*> (glob) | |
|
209 | To: baz, foo@bar | |
|
214 | Message-Id: <hg.ba3098a36bd4c297288d16788623a841f81f618ea961a0f0fd65de7eb1191b66@example.com> | |
|
215 | To: baz@example.com, foo@bar | |
|
210 | 216 | |
|
211 | 217 | changeset 00a13f371396 in $TESTTMP/b |
|
212 | 218 | details: $TESTTMP/b?cmd=changeset;node=00a13f371396 |
General Comments 0
You need to be logged in to leave comments.
Login now