[PATCH 1 of 5] dispatch: use print function

Gregory Szorc gregory.szorc at gmail.com
Sat Jan 2 13:54:43 CST 2016


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1434948341 25200
#      Sun Jun 21 21:45:41 2015 -0700
# Node ID 73efe1469d54a26d4b438efb3fdfac5d7947b6f6
# Parent  3ed88f67769061aec1a6de827f739c3f65463952
dispatch: use print function

Python 3 doesn't have a print statement.

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -1,16 +1,16 @@
 # dispatch.py - command dispatching for mercurial
 #
 # Copyright 2005-2007 Matt Mackall <mpm at selenic.com>
 #
 # 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
+from __future__ import absolute_import, print_function
 
 import atexit
 import difflib
 import errno
 import os
 import pdb
 import re
 import shlex
@@ -975,19 +975,19 @@ def flameprofile(ui, func, fp):
                                       filter_, collapse_recursion)
     start_time = time.clock()
     try:
         thread.start()
         func()
     finally:
         thread.stop()
         thread.join()
-        print 'Collected %d stack frames (%d unique) in %2.2f seconds.' % (
+        print('Collected %d stack frames (%d unique) in %2.2f seconds.' % (
             time.clock() - start_time, thread.num_frames(),
-            thread.num_frames(unique=True))
+            thread.num_frames(unique=True)))
 
 
 def statprofile(ui, func, fp):
     try:
         import statprof
     except ImportError:
         raise error.Abort(_(
             'statprof not available - install using "easy_install statprof"'))
diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t
+++ b/tests/test-check-py3-compat.t
@@ -93,17 +93,16 @@
   hgext/transplant.py not using absolute_import
   hgext/win32mbcs.py not using absolute_import
   hgext/win32text.py not using absolute_import
   hgext/zeroconf/Zeroconf.py not using absolute_import
   hgext/zeroconf/Zeroconf.py requires print_function
   hgext/zeroconf/__init__.py not using absolute_import
   i18n/check-translation.py not using absolute_import
   i18n/polib.py not using absolute_import
-  mercurial/dispatch.py requires print_function
   mercurial/keepalive.py requires print_function
   mercurial/lsprof.py requires print_function
   mercurial/lsprofcalltree.py requires print_function
   mercurial/mail.py requires print_function
   setup.py not using absolute_import
   tests/filterpyflakes.py requires print_function
   tests/generate-working-copy-states.py requires print_function
   tests/get-with-headers.py requires print_function


More information about the Mercurial-devel mailing list