[PATCH] check-config.py: use absolute_import and print_function

Pulkit Goyal 7895pulkit at gmail.com
Tue Mar 1 17:44:44 EST 2016


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1456872167 -19800
#      Wed Mar 02 04:12:47 2016 +0530
# Node ID a0ae243e92e51839e96c21da19e77d6ff0d69db2
# Parent  90d2a0ee68b0c280db54ac2af7c0446c336b3021
check-config.py: Added absolute_import and print_function

diff -r 90d2a0ee68b0 -r a0ae243e92e5 contrib/check-config.py
--- a/contrib/check-config.py    Wed Mar 02 04:05:04 2016 +0530
+++ b/contrib/check-config.py    Wed Mar 02 04:12:47 2016 +0530
@@ -7,6 +7,8 @@
 # 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 print_function
 import re
 import sys

@@ -82,9 +84,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 +104,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 90d2a0ee68b0 -r a0ae243e92e5 tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t    Wed Mar 02 04:05:04 2016 +0530
+++ b/tests/test-check-py3-compat.t    Wed Mar 02 04:12:47 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