Mercurial > hg > mercurial-crew-with-dirclash
comparison hgext/notify.py @ 2329:90368f89340a
notify: add debug output. do not fail if no config file.
use --debug to see debug output.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Sat, 20 May 2006 12:52:02 -0700 |
parents | d0ba2f6b9d97 |
children | 6b27a7125b67 |
comparison
equal
deleted
inserted
replaced
2328:f789602ba840 | 2329:90368f89340a |
---|---|
97 class notifier(object): | 97 class notifier(object): |
98 '''email notification class.''' | 98 '''email notification class.''' |
99 | 99 |
100 def __init__(self, ui, repo, hooktype): | 100 def __init__(self, ui, repo, hooktype): |
101 self.ui = ui | 101 self.ui = ui |
102 self.ui.readconfig(self.ui.config('notify', 'config')) | 102 cfg = self.ui.config('notify', 'config') |
103 if cfg: | |
104 self.ui.readconfig(cfg) | |
103 self.repo = repo | 105 self.repo = repo |
104 self.stripcount = int(self.ui.config('notify', 'strip', 0)) | 106 self.stripcount = int(self.ui.config('notify', 'strip', 0)) |
105 self.root = self.strip(self.repo.root) | 107 self.root = self.strip(self.repo.root) |
106 self.domain = self.ui.config('notify', 'domain') | 108 self.domain = self.ui.config('notify', 'domain') |
107 self.sio = templater.stringio() | 109 self.sio = templater.stringio() |
223 if self.ui.configbool('notify', 'test', True): | 225 if self.ui.configbool('notify', 'test', True): |
224 self.ui.write(msgtext) | 226 self.ui.write(msgtext) |
225 if not msgtext.endswith('\n'): | 227 if not msgtext.endswith('\n'): |
226 self.ui.write('\n') | 228 self.ui.write('\n') |
227 else: | 229 else: |
230 self.ui.status(_('notify: sending %d subscribers %d changes\n') % | |
231 (len(self.subs), count)) | |
228 mail = self.ui.sendmail() | 232 mail = self.ui.sendmail() |
229 mail.sendmail(templater.email(msg['From']), self.subs, msgtext) | 233 mail.sendmail(templater.email(msg['From']), self.subs, msgtext) |
230 | 234 |
231 def diff(self, node, ref): | 235 def diff(self, node, ref): |
232 maxdiff = int(self.ui.config('notify', 'maxdiff', 300)) | 236 maxdiff = int(self.ui.config('notify', 'maxdiff', 300)) |
248 '''send email notifications to interested subscribers. | 252 '''send email notifications to interested subscribers. |
249 | 253 |
250 if used as changegroup hook, send one email for all changesets in | 254 if used as changegroup hook, send one email for all changesets in |
251 changegroup. else send one email per changeset.''' | 255 changegroup. else send one email per changeset.''' |
252 n = notifier(ui, repo, hooktype) | 256 n = notifier(ui, repo, hooktype) |
253 if not n.subs or n.skipsource(source): | 257 if not n.subs: |
258 ui.debug(_('notify: no subscribers to this repo\n')) | |
259 return | |
260 if n.skipsource(source): | |
261 ui.debug(_('notify: changes have source "%s" - skipping\n') % | |
262 source) | |
254 return | 263 return |
255 node = bin(node) | 264 node = bin(node) |
256 if hooktype == 'changegroup': | 265 if hooktype == 'changegroup': |
257 start = repo.changelog.rev(node) | 266 start = repo.changelog.rev(node) |
258 end = repo.changelog.count() | 267 end = repo.changelog.count() |