[PATCH 3 of 6]check-config: use absolute_import and print_function

Pulkit Goyal 7895pulkit at gmail.com
Sat Mar 5 21:33:27 UTC 2016


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1457213506 -19800
#      Sun Mar 06 03:01:46 2016 +0530
# Node ID 287c62ddd09a42cdea24f6ccbb29f4ccc8ce6ced
# Parent  66064b2c5c954a4f050f76d34d8d77060a2dcc73
check-config: use absolute_import and print_function

diff -r 66064b2c5c95 -r 287c62ddd09a contrib/check-config.py
--- a/contrib/check-config.py    Sun Mar 06 02:52:38 2016 +0530
+++ b/contrib/check-config.py    Sun Mar 06 03:01:46 2016 +0530
@@ -7,6 +7,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
 import re
 import sys

@@ -82,9 +83,9 @@
                 if re.match('[a-z.]+$', default):
                     default = '<variable>'
                 if name in foundopts and (ctype, default) != foundopts[name]:
-                    print l
-                    print "conflict on %s: %r != %r" % (name, (ctype, default),
-                                                        foundopts[name])
+                    print(l)
+                    print("conflict on %s: %r != %r" % (name, (ctype, default),
+                                                        foundopts[name]))
                 foundopts[name] = (ctype, default)
                 carryover = ''
             else:
@@ -102,7 +103,7 @@
                 ctype, default = foundopts[name]
                 if default:
                     default = ' [%s]' % default
-                print "undocumented: %s (%s)%s" % (name, ctype, default)
+                print("undocumented: %s (%s)%s" % (name, ctype, default))

 if __name__ == "__main__":
     if len(sys.argv) > 1:
diff -r 66064b2c5c95 -r 287c62ddd09a tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t    Sun Mar 06 02:52:38 2016 +0530
+++ b/tests/test-check-py3-compat.t    Sun Mar 06 03:01:46 2016 +0530
@@ -3,8 +3,6 @@
   $ cd "$TESTDIR"/..

   $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python
contrib/check-py3-compat.py
-  contrib/check-config.py not using absolute_import
-  contrib/check-config.py requires print_function
   contrib/debugcmdserver.py not using absolute_import
   contrib/debugcmdserver.py requires print_function
   contrib/debugshell.py not using absolute_import


More information about the Mercurial-devel mailing list