Mercurial > hg
comparison hgext/notify.py @ 43322:7d912413a3ae stable
py3: use as_bytes() method of EmailMessage
In Python 3, as_bytes() corresponds to as_string() in Python 2.
author | Denis Laxalde <denis.laxalde@logilab.fr> |
---|---|
date | Thu, 10 Oct 2019 13:48:30 +0200 |
parents | c32531444cdc |
children | ef81de93143e |
comparison
equal
deleted
inserted
replaced
43321:a2ff3aff81d2 | 43322:7d912413a3ae |
---|---|
438 msg[r'X-Hg-Notification'] = r'changeset %s' % ctx | 438 msg[r'X-Hg-Notification'] = r'changeset %s' % ctx |
439 if not msg[r'Message-Id']: | 439 if not msg[r'Message-Id']: |
440 msg[r'Message-Id'] = messageid(ctx, self.domain, self.messageidseed) | 440 msg[r'Message-Id'] = messageid(ctx, self.domain, self.messageidseed) |
441 msg[r'To'] = encoding.strfromlocal(b', '.join(sorted(subs))) | 441 msg[r'To'] = encoding.strfromlocal(b', '.join(sorted(subs))) |
442 | 442 |
443 msgtext = encoding.strtolocal(msg.as_string()) | 443 msgtext = msg.as_bytes() if pycompat.ispy3 else msg.as_string() |
444 if self.test: | 444 if self.test: |
445 self.ui.write(msgtext) | 445 self.ui.write(msgtext) |
446 if not msgtext.endswith(b'\n'): | 446 if not msgtext.endswith(b'\n'): |
447 self.ui.write(b'\n') | 447 self.ui.write(b'\n') |
448 else: | 448 else: |