diff hgext/notify.py @ 15561:ca572e94d8e7

notify: add option for writing to mbox This makes it possible to test how the mails that are sent _really_ look like.
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 23 Nov 2011 02:36:33 +0100
parents d78b92353f26
children 2a7fa7c641d8
line wrap: on
line diff
--- a/hgext/notify.py	Wed Nov 23 02:11:24 2011 +0100
+++ b/hgext/notify.py	Wed Nov 23 02:36:33 2011 +0100
@@ -105,6 +105,9 @@
 notify.merge
   If True, send notifications for merge changesets. Default: True.
 
+notify.mbox
+  If set, append mails to this mbox file instead of sending. Default: None.
+
 If set, the following entries will also be used to customize the notifications:
 
 email.from
@@ -156,6 +159,7 @@
         self.stripcount = int(self.ui.config('notify', 'strip', 0))
         self.root = self.strip(self.repo.root)
         self.domain = self.ui.config('notify', 'domain')
+        self.mbox = self.ui.config('notify', 'mbox')
         self.test = self.ui.configbool('notify', 'test', True)
         self.charsets = mail._charsets(self.ui)
         self.subs = self.subscribers()
@@ -288,7 +292,7 @@
             self.ui.status(_('notify: sending %d subscribers %d changes\n') %
                            (len(self.subs), count))
             mail.sendmail(self.ui, util.email(msg['From']),
-                          self.subs, msgtext)
+                          self.subs, msgtext, mbox=self.mbox)
 
     def diff(self, ctx, ref=None):