equal
deleted
inserted
replaced
147 mail, |
147 mail, |
148 patch, |
148 patch, |
149 registrar, |
149 registrar, |
150 util, |
150 util, |
151 ) |
151 ) |
152 from mercurial.utils import dateutil |
152 from mercurial.utils import ( |
|
153 dateutil, |
|
154 stringutil, |
|
155 ) |
153 |
156 |
154 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
157 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
155 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
158 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
156 # be specifying the version(s) of Mercurial they are tested with, or |
159 # be specifying the version(s) of Mercurial they are tested with, or |
157 # leave the attribute unspecified. |
160 # leave the attribute unspecified. |
275 return path |
278 return path |
276 |
279 |
277 def fixmail(self, addr): |
280 def fixmail(self, addr): |
278 '''try to clean up email addresses.''' |
281 '''try to clean up email addresses.''' |
279 |
282 |
280 addr = util.email(addr.strip()) |
283 addr = stringutil.email(addr.strip()) |
281 if self.domain: |
284 if self.domain: |
282 a = addr.find('@localhost') |
285 a = addr.find('@localhost') |
283 if a != -1: |
286 if a != -1: |
284 addr = addr[:a] |
287 addr = addr[:a] |
285 if '@' not in addr: |
288 if '@' not in addr: |
370 else: |
373 else: |
371 s = ctx.description().lstrip().split('\n', 1)[0].rstrip() |
374 s = ctx.description().lstrip().split('\n', 1)[0].rstrip() |
372 subject = '%s: %s' % (self.root, s) |
375 subject = '%s: %s' % (self.root, s) |
373 maxsubject = int(self.ui.config('notify', 'maxsubject')) |
376 maxsubject = int(self.ui.config('notify', 'maxsubject')) |
374 if maxsubject: |
377 if maxsubject: |
375 subject = util.ellipsis(subject, maxsubject) |
378 subject = stringutil.ellipsis(subject, maxsubject) |
376 msg['Subject'] = mail.headencode(self.ui, subject, |
379 msg['Subject'] = mail.headencode(self.ui, subject, |
377 self.charsets, self.test) |
380 self.charsets, self.test) |
378 |
381 |
379 # try to make message have proper sender |
382 # try to make message have proper sender |
380 if not sender: |
383 if not sender: |
397 if not msgtext.endswith('\n'): |
400 if not msgtext.endswith('\n'): |
398 self.ui.write('\n') |
401 self.ui.write('\n') |
399 else: |
402 else: |
400 self.ui.status(_('notify: sending %d subscribers %d changes\n') % |
403 self.ui.status(_('notify: sending %d subscribers %d changes\n') % |
401 (len(subs), count)) |
404 (len(subs), count)) |
402 mail.sendmail(self.ui, util.email(msg['From']), |
405 mail.sendmail(self.ui, stringutil.email(msg['From']), |
403 subs, msgtext, mbox=self.mbox) |
406 subs, msgtext, mbox=self.mbox) |
404 |
407 |
405 def diff(self, ctx, ref=None): |
408 def diff(self, ctx, ref=None): |
406 |
409 |
407 maxdiff = int(self.ui.config('notify', 'maxdiff')) |
410 maxdiff = int(self.ui.config('notify', 'maxdiff')) |