[PATCH] check-code.py: Check for bare ^

Mads Kiilerich mads at kiilerich.com
Wed Mar 31 04:15:01 CDT 2010


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1270026466 -7200
# Branch stable
# Node ID 7e7d1692bf1a89931133df0eb3470a8504ef9112
# Parent  c2f47c63f83fe52be8c9ba453b3beaea5cff1141
check-code.py: Check for bare ^

Solaris sh interprets ^ as some kind of piping symbol.

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -53,6 +53,7 @@
     (r'\$PWD', "don't use $PWD, use `pwd`"),
     (r'[^\n]\Z', "no trailing newline"),
     (r'export.*=', "don't export and assign at once"),
+    ('^([^"\']|("[^"]*")|(\'[^\']*\'))*\\^', "^ must be quoted"),
 ]
 
 testfilters = [
diff --git a/tests/test-convert-baz b/tests/test-convert-baz
--- a/tests/test-convert-baz
+++ b/tests/test-convert-baz
@@ -30,7 +30,7 @@
 dd count=1 if=/dev/zero of=b > /dev/null 2> /dev/null
 baz add b
 # HACK: hide GNU tar-1.22 "tar: The --preserve option is deprecated, use --preserve-permissions --preserve-order instead"
-baz commit -s "added a file, src and src/b (binary)" 2>&1 | grep -v ^tar
+baz commit -s "added a file, src and src/b (binary)" 2>&1 | grep -v '^tar'
 
 echo % create link file and modify a
 ln -s ../a a-link
diff --git a/tests/test-convert-cvs-synthetic b/tests/test-convert-cvs-synthetic
--- a/tests/test-convert-cvs-synthetic
+++ b/tests/test-convert-cvs-synthetic
@@ -110,7 +110,7 @@
 
 echo "% convert to hg (#2: with merge detection)"
 filterpath hg convert \
-  --config convert.cvsps.mergefrom="\"^MERGE from (\S+):\"" \
+  --config convert.cvsps.mergefrom='"^MERGE from (\S+):"' \
   --datesort \
   proj proj.hg2
 


More information about the Mercurial-devel mailing list