Mercurial > public > mercurial-scm > hg
comparison mercurial/mail.py @ 30325:f6369544bf85
mail: do not print(), use ui.debug() instead
Since print() can't take a bytes output, it's pretty useless in Mercurial
on Python 3. As this is a debug message, switching to ui.debug() seems fine.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 20 Oct 2016 22:20:31 +0900 |
parents | 040f23ed6963 |
children | 067add650129 |
comparison
equal
deleted
inserted
replaced
30324:cb1ea3cc44b5 | 30325:f6369544bf85 |
---|---|
3 # Copyright 2006 Matt Mackall <mpm@selenic.com> | 3 # Copyright 2006 Matt Mackall <mpm@selenic.com> |
4 # | 4 # |
5 # This software may be used and distributed according to the terms of the | 5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | 7 |
8 from __future__ import absolute_import, print_function | 8 from __future__ import absolute_import |
9 | 9 |
10 import email | 10 import email |
11 import email.charset | 11 import email.charset |
12 import email.header | 12 import email.header |
13 import os | 13 import os |
14 import quopri | 14 import quopri |
15 import smtplib | 15 import smtplib |
16 import socket | 16 import socket |
17 import sys | |
18 import time | 17 import time |
19 | 18 |
20 from .i18n import _ | 19 from .i18n import _ |
21 from . import ( | 20 from . import ( |
22 encoding, | 21 encoding, |
85 self.default_port = smtplib.SMTP_SSL_PORT | 84 self.default_port = smtplib.SMTP_SSL_PORT |
86 self._ui = ui | 85 self._ui = ui |
87 | 86 |
88 def _get_socket(self, host, port, timeout): | 87 def _get_socket(self, host, port, timeout): |
89 if self.debuglevel > 0: | 88 if self.debuglevel > 0: |
90 print('connect:', (host, port), file=sys.stderr) | 89 self._ui.debug('connect: %r\n' % (host, port)) |
91 new_socket = socket.create_connection((host, port), timeout) | 90 new_socket = socket.create_connection((host, port), timeout) |
92 new_socket = sslutil.wrapsocket(new_socket, | 91 new_socket = sslutil.wrapsocket(new_socket, |
93 self.keyfile, self.certfile, | 92 self.keyfile, self.certfile, |
94 ui=self._ui, | 93 ui=self._ui, |
95 serverhostname=self._host) | 94 serverhostname=self._host) |