[PATCH 1 of 5] check-code: fix py3 complaint about \NNN being invalid unicode

timeless timeless at fmr.im
Wed May 11 04:12:46 UTC 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1462931768 0
#      Wed May 11 01:56:08 2016 +0000
# Node ID 0ae3c041551b65d04ce0cccecf5343cf86afc2d5
# Parent  d115cbf5980b451e94f429fb57a29ca2cd279676
# EXP-Topic runtests
# Available At bb://timeless/mercurial-crew
#              hg pull bb://timeless/mercurial-crew -r 0ae3c041551b
check-code: fix py3 complaint about \NNN being invalid unicode

diff -r d115cbf5980b -r 0ae3c041551b contrib/check-code.py
--- a/contrib/check-code.py	Thu May 05 17:06:54 2016 -0700
+++ b/contrib/check-code.py	Wed May 11 01:56:08 2016 +0000
@@ -103,7 +103,7 @@
     (r'tail -n', "don't use the '-n' option to tail, just use '-<num>'"),
     (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"),
     (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"),
-    (r'printf.*[^\\]\\([1-9]|0\d)', "don't use 'printf \NNN', use Python"),
+    (r'printf.*[^\\]\\([1-9]|0\d)', r"don't use 'printf \NNN', use Python"),
     (r'printf.*[^\\]\\x', "don't use printf \\x, use Python"),
     (r'\$\(.*\)', "don't use $(expr), use `expr`"),
     (r'rm -rf \*', "don't use naked rm -rf, target a directory"),
diff -r d115cbf5980b -r 0ae3c041551b tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t	Thu May 05 17:06:54 2016 -0700
+++ b/tests/test-check-py3-compat.t	Wed May 11 01:56:08 2016 +0000
@@ -37,7 +37,6 @@
 
 #if py3exe
   $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py
-  contrib/check-code.py: invalid syntax: (unicode error) 'unicodeescape' codec can't decode bytes in position *-*: malformed \N character escape (<unknown>, line *) (glob)
   doc/hgmanpage.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   hgext/automv.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob)
   hgext/blackbox.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)


More information about the Mercurial-devel mailing list