##// END OF EJS Templates
notify: add option for writing to mbox...
Mads Kiilerich -
r15561:ca572e94 default
parent child Browse files
Show More
@@ -105,6 +105,9 b' notify.diffstat'
105 notify.merge
105 notify.merge
106 If True, send notifications for merge changesets. Default: True.
106 If True, send notifications for merge changesets. Default: True.
107
107
108 notify.mbox
109 If set, append mails to this mbox file instead of sending. Default: None.
110
108 If set, the following entries will also be used to customize the notifications:
111 If set, the following entries will also be used to customize the notifications:
109
112
110 email.from
113 email.from
@@ -156,6 +159,7 b' class notifier(object):'
156 self.stripcount = int(self.ui.config('notify', 'strip', 0))
159 self.stripcount = int(self.ui.config('notify', 'strip', 0))
157 self.root = self.strip(self.repo.root)
160 self.root = self.strip(self.repo.root)
158 self.domain = self.ui.config('notify', 'domain')
161 self.domain = self.ui.config('notify', 'domain')
162 self.mbox = self.ui.config('notify', 'mbox')
159 self.test = self.ui.configbool('notify', 'test', True)
163 self.test = self.ui.configbool('notify', 'test', True)
160 self.charsets = mail._charsets(self.ui)
164 self.charsets = mail._charsets(self.ui)
161 self.subs = self.subscribers()
165 self.subs = self.subscribers()
@@ -288,7 +292,7 b' class notifier(object):'
288 self.ui.status(_('notify: sending %d subscribers %d changes\n') %
292 self.ui.status(_('notify: sending %d subscribers %d changes\n') %
289 (len(self.subs), count))
293 (len(self.subs), count))
290 mail.sendmail(self.ui, util.email(msg['From']),
294 mail.sendmail(self.ui, util.email(msg['From']),
291 self.subs, msgtext)
295 self.subs, msgtext, mbox=self.mbox)
292
296
293 def diff(self, ctx, ref=None):
297 def diff(self, ctx, ref=None):
294
298
@@ -114,8 +114,8 b' def connect(ui, mbox=None):'
114 return _smtp(ui)
114 return _smtp(ui)
115 return lambda s, r, m: _sendmail(ui, s, r, m)
115 return lambda s, r, m: _sendmail(ui, s, r, m)
116
116
117 def sendmail(ui, sender, recipients, msg):
117 def sendmail(ui, sender, recipients, msg, mbox=None):
118 send = connect(ui)
118 send = connect(ui, mbox=mbox)
119 return send(sender, recipients, msg)
119 return send(sender, recipients, msg)
120
120
121 def validateconfig(ui):
121 def validateconfig(ui):
@@ -113,6 +113,9 b''
113 notify.merge
113 notify.merge
114 If True, send notifications for merge changesets. Default: True.
114 If True, send notifications for merge changesets. Default: True.
115
115
116 notify.mbox
117 If set, append mails to this mbox file instead of sending. Default: None.
118
116 If set, the following entries will also be used to customize the
119 If set, the following entries will also be used to customize the
117 notifications:
120 notifications:
118
121
@@ -350,7 +353,7 b' test merge'
350 description: merge
353 description: merge
351 (run 'hg update' to get a working copy)
354 (run 'hg update' to get a working copy)
352
355
353 truncate multi-byte subject
356 non-ascii content and truncation of multi-byte subject
354
357
355 $ cat <<EOF >> $HGRCPATH
358 $ cat <<EOF >> $HGRCPATH
356 > [notify]
359 > [notify]
@@ -395,3 +398,54 b' truncate multi-byte subject'
395 a
398 a
396 +a
399 +a
397 (run 'hg update' to get a working copy)
400 (run 'hg update' to get a working copy)
401
402 long lines
403
404 $ cat <<EOF >> $HGRCPATH
405 > [notify]
406 > maxsubject = 67
407 > test = False
408 > mbox = mbox
409 > EOF
410 $ python -c 'print "no" * 500' >> a/a
411 $ hg --cwd a commit -A -m "long line"
412 $ hg --traceback --cwd b pull ../a
413 pulling from ../a
414 searching for changes
415 adding changesets
416 adding manifests
417 adding file changes
418 added 1 changesets with 1 changes to 1 files
419 notify: sending 2 subscribers 1 changes
420 (run 'hg update' to get a working copy)
421 $ python -c 'import sys,re; print re.sub("\n\t", " ", file("b/mbox").read()),'
422 From test@test.com ... ... .. ..:..:.. .... (re)
423 Content-Type: text/plain; charset="us-ascii"
424 MIME-Version: 1.0
425 Content-Transfer-Encoding: 7bit
426 X-Test: foo
427 Date: * (glob)
428 Subject: long line
429 From: test@test.com
430 X-Hg-Notification: changeset e0be44cf638b
431 Message-Id: <hg.e0be44cf638b.*.*@*> (glob)
432 To: baz@test.com, foo@bar
433
434 changeset e0be44cf638b in b
435 description: long line
436 diffstat:
437
438 a | 1 +
439 1 files changed, 1 insertions(+), 0 deletions(-)
440
441 diffs (8 lines):
442
443 diff -r 7ea05ad269dc -r e0be44cf638b a
444 --- a/a Thu Jan 01 00:00:00 1970 +0000
445 +++ b/a Thu Jan 01 00:00:00 1970 +0000
446 @@ -1,3 +1,4 @@
447 a
448 a
449 a
450 +nononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononononono
451
General Comments 0
You need to be logged in to leave comments. Login now