equal
deleted
inserted
replaced
91 summary: {desc|firstline} |
91 summary: {desc|firstline} |
92 ''' |
92 ''' |
93 |
93 |
94 deftemplates = { |
94 deftemplates = { |
95 'changegroup': multiple_template, |
95 'changegroup': multiple_template, |
96 } |
96 } |
97 |
97 |
98 class notifier(object): |
98 class notifier(object): |
99 '''email notification class.''' |
99 '''email notification class.''' |
100 |
100 |
101 def __init__(self, ui, repo, hooktype): |
101 def __init__(self, ui, repo, hooktype): |
210 sender = self.fixmail(sender) |
210 sender = self.fixmail(sender) |
211 del msg['From'] |
211 del msg['From'] |
212 msg['From'] = sender |
212 msg['From'] = sender |
213 |
213 |
214 msg['Date'] = util.datestr(date=util.makedate(), |
214 msg['Date'] = util.datestr(date=util.makedate(), |
215 format="%a, %d %b %Y %H:%M:%S", timezone=True) |
215 format="%a, %d %b %Y %H:%M:%S", |
|
216 timezone=True) |
216 fix_subject() |
217 fix_subject() |
217 fix_sender() |
218 fix_sender() |
218 |
219 |
219 msg['X-Hg-Notification'] = 'changeset ' + short(node) |
220 msg['X-Hg-Notification'] = 'changeset ' + short(node) |
220 if not msg['Message-Id']: |
221 if not msg['Message-Id']: |
228 self.ui.write(msgtext) |
229 self.ui.write(msgtext) |
229 if not msgtext.endswith('\n'): |
230 if not msgtext.endswith('\n'): |
230 self.ui.write('\n') |
231 self.ui.write('\n') |
231 else: |
232 else: |
232 self.ui.status(_('notify: sending %d subscribers %d changes\n') % |
233 self.ui.status(_('notify: sending %d subscribers %d changes\n') % |
233 (len(self.subs), count)) |
234 (len(self.subs), count)) |
234 mail.sendmail(self.ui, templater.email(msg['From']), |
235 mail.sendmail(self.ui, templater.email(msg['From']), |
235 self.subs, msgtext) |
236 self.subs, msgtext) |
236 |
237 |
237 def diff(self, node, ref): |
238 def diff(self, node, ref): |
238 maxdiff = int(self.ui.config('notify', 'maxdiff', 300)) |
239 maxdiff = int(self.ui.config('notify', 'maxdiff', 300)) |
264 if not n.subs: |
265 if not n.subs: |
265 ui.debug(_('notify: no subscribers to repo %s\n') % n.root) |
266 ui.debug(_('notify: no subscribers to repo %s\n') % n.root) |
266 return |
267 return |
267 if n.skipsource(source): |
268 if n.skipsource(source): |
268 ui.debug(_('notify: changes have source "%s" - skipping\n') % |
269 ui.debug(_('notify: changes have source "%s" - skipping\n') % |
269 source) |
270 source) |
270 return |
271 return |
271 node = bin(node) |
272 node = bin(node) |
272 ui.pushbuffer() |
273 ui.pushbuffer() |
273 if hooktype == 'changegroup': |
274 if hooktype == 'changegroup': |
274 start = repo.changelog.rev(node) |
275 start = repo.changelog.rev(node) |