mail: do not print(), use ui.debug() instead
authorYuya Nishihara <yuya@tcha.org>
Thu, 20 Oct 2016 22:20:31 +0900
changeset 30335 f6369544bf85
parent 30334 cb1ea3cc44b5
child 30336 eac5c1737f79
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.
mercurial/mail.py
--- a/mercurial/mail.py	Thu Oct 20 22:12:48 2016 +0900
+++ b/mercurial/mail.py	Thu Oct 20 22:20:31 2016 +0900
@@ -5,7 +5,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import
 
 import email
 import email.charset
@@ -14,7 +14,6 @@
 import quopri
 import smtplib
 import socket
-import sys
 import time
 
 from .i18n import _
@@ -87,7 +86,7 @@
 
     def _get_socket(self, host, port, timeout):
         if self.debuglevel > 0:
-            print('connect:', (host, port), file=sys.stderr)
+            self._ui.debug('connect: %r\n' % (host, port))
         new_socket = socket.create_connection((host, port), timeout)
         new_socket = sslutil.wrapsocket(new_socket,
                                         self.keyfile, self.certfile,