Show More
@@ -149,6 +149,7 b' import time' | |||
|
149 | 149 | |
|
150 | 150 | from mercurial.i18n import _ |
|
151 | 151 | from mercurial import ( |
|
152 | encoding, | |
|
152 | 153 | error, |
|
153 | 154 | logcmdutil, |
|
154 | 155 | mail, |
@@ -361,13 +362,14 b' class notifier(object):' | |||
|
361 | 362 | |
|
362 | 363 | p = emailparser.Parser() |
|
363 | 364 | try: |
|
364 | msg = p.parsestr(data) | |
|
365 | msg = p.parsestr(encoding.strfromlocal(data)) | |
|
365 | 366 | except emailerrors.MessageParseError as inst: |
|
366 | 367 | raise error.Abort(inst) |
|
367 | 368 | |
|
368 | 369 | # store sender and subject |
|
369 | sender, subject = msg['From'], msg['Subject'] | |
|
370 | del msg['From'], msg['Subject'] | |
|
370 | sender = encoding.strtolocal(msg[r'From']) | |
|
371 | subject = encoding.strtolocal(msg[r'Subject']) | |
|
372 | del msg[r'From'], msg[r'Subject'] | |
|
371 | 373 | |
|
372 | 374 | if not msg.is_multipart(): |
|
373 | 375 | # create fresh mime message from scratch |
@@ -380,7 +382,8 b' class notifier(object):' | |||
|
380 | 382 | for k, v in headers: |
|
381 | 383 | msg[k] = v |
|
382 | 384 | |
|
383 | msg['Date'] = dateutil.datestr(format="%a, %d %b %Y %H:%M:%S %1%2") | |
|
385 | msg[r'Date'] = encoding.strfromlocal( | |
|
386 | dateutil.datestr(format="%a, %d %b %Y %H:%M:%S %1%2")) | |
|
384 | 387 | |
|
385 | 388 | # try to make subject line exist and be useful |
|
386 | 389 | if not subject: |
@@ -392,25 +395,26 b' class notifier(object):' | |||
|
392 | 395 | maxsubject = int(self.ui.config('notify', 'maxsubject')) |
|
393 | 396 | if maxsubject: |
|
394 | 397 | subject = stringutil.ellipsis(subject, maxsubject) |
|
395 | msg['Subject'] = mail.headencode(self.ui, subject, | |
|
396 | self.charsets, self.test) | |
|
398 | msg[r'Subject'] = encoding.strfromlocal( | |
|
399 | mail.headencode(self.ui, subject, self.charsets, self.test)) | |
|
397 | 400 | |
|
398 | 401 | # try to make message have proper sender |
|
399 | 402 | if not sender: |
|
400 | 403 | sender = self.ui.config('email', 'from') or self.ui.username() |
|
401 | 404 | if '@' not in sender or '@localhost' in sender: |
|
402 | 405 | sender = self.fixmail(sender) |
|
403 | msg['From'] = mail.addressencode(self.ui, sender, | |
|
404 | self.charsets, self.test) | |
|
406 | msg[r'From'] = encoding.strfromlocal( | |
|
407 | mail.addressencode(self.ui, sender, self.charsets, self.test)) | |
|
405 | 408 | |
|
406 | msg['X-Hg-Notification'] = 'changeset %s' % ctx | |
|
407 | if not msg['Message-Id']: | |
|
408 |
msg['Message-Id'] = ( |
|
|
409 |
|
|
|
410 |
hash(self.repo.root), |
|
|
411 | msg['To'] = ', '.join(sorted(subs)) | |
|
409 | msg[r'X-Hg-Notification'] = r'changeset %s' % ctx | |
|
410 | if not msg[r'Message-Id']: | |
|
411 | msg[r'Message-Id'] = encoding.strfromlocal( | |
|
412 | '<hg.%s.%d.%d@%s>' % (ctx, int(time.time()), | |
|
413 | hash(self.repo.root), | |
|
414 | encoding.strtolocal(socket.getfqdn()))) | |
|
415 | msg[r'To'] = encoding.strfromlocal(', '.join(sorted(subs))) | |
|
412 | 416 | |
|
413 | msgtext = msg.as_string() | |
|
417 | msgtext = encoding.strtolocal(msg.as_string()) | |
|
414 | 418 | if self.test: |
|
415 | 419 | self.ui.write(msgtext) |
|
416 | 420 | if not msgtext.endswith('\n'): |
@@ -418,7 +422,7 b' class notifier(object):' | |||
|
418 | 422 | else: |
|
419 | 423 | self.ui.status(_('notify: sending %d subscribers %d changes\n') % |
|
420 | 424 | (len(subs), count)) |
|
421 | mail.sendmail(self.ui, stringutil.email(msg['From']), | |
|
425 | mail.sendmail(self.ui, stringutil.email(msg[r'From']), | |
|
422 | 426 | subs, msgtext, mbox=self.mbox) |
|
423 | 427 | |
|
424 | 428 | def diff(self, ctx, ref=None): |
General Comments 0
You need to be logged in to leave comments.
Login now