hgext/notify.py
changeset 2909 20b95aef3fe0
parent 2873 4ec58b157265
child 3014 47aad3489da8
equal deleted inserted replaced
2908:3848488244fc 2909:20b95aef3fe0
    65 # push changes to, they can manage their own subscriptions.
    65 # push changes to, they can manage their own subscriptions.
    66 
    66 
    67 from mercurial.demandload import *
    67 from mercurial.demandload import *
    68 from mercurial.i18n import gettext as _
    68 from mercurial.i18n import gettext as _
    69 from mercurial.node import *
    69 from mercurial.node import *
    70 demandload(globals(), 'email.Parser mercurial:commands,patch,templater,util')
    70 demandload(globals(), 'mercurial:commands,patch,templater,util,mail')
    71 demandload(globals(), 'fnmatch socket time')
    71 demandload(globals(), 'email.Parser fnmatch socket time')
    72 
    72 
    73 # template for single changeset can include email headers.
    73 # template for single changeset can include email headers.
    74 single_template = '''
    74 single_template = '''
    75 Subject: changeset in {webroot}: {desc|firstline|strip}
    75 Subject: changeset in {webroot}: {desc|firstline|strip}
    76 From: {author}
    76 From: {author}
   227             if not msgtext.endswith('\n'):
   227             if not msgtext.endswith('\n'):
   228                 self.ui.write('\n')
   228                 self.ui.write('\n')
   229         else:
   229         else:
   230             self.ui.status(_('notify: sending %d subscribers %d changes\n') %
   230             self.ui.status(_('notify: sending %d subscribers %d changes\n') %
   231                              (len(self.subs), count))
   231                              (len(self.subs), count))
   232             mail = self.ui.sendmail()
   232             mail.sendmail(self.ui, templater.email(msg['From']),
   233             mail.sendmail(templater.email(msg['From']), self.subs, msgtext)
   233                           self.subs, msgtext)
   234 
   234 
   235     def diff(self, node, ref):
   235     def diff(self, node, ref):
   236         maxdiff = int(self.ui.config('notify', 'maxdiff', 300))
   236         maxdiff = int(self.ui.config('notify', 'maxdiff', 300))
   237         if maxdiff == 0:
   237         if maxdiff == 0:
   238             return
   238             return