# HG changeset patch # User Kevin Bullock # Date 1366667408 18000 # Node ID e97ce4a5afc5c68764a951f125c125880018adbf # Parent 5e4491c114b24a699b00a8c6de312a6499b6aa5d check-code: expand sed rule to include more offenders Expands the rule added in 5e4491c114b2 to include cases where the address is a line number instead of a regular expression, and fixes an instance of this pattern in test-unionrepo.t. diff -r 5e4491c114b2 -r e97ce4a5afc5 contrib/check-code.py --- a/contrib/check-code.py Mon Apr 22 16:33:28 2013 -0500 +++ b/contrib/check-code.py Mon Apr 22 16:50:08 2013 -0500 @@ -74,7 +74,7 @@ (r'/dev/u?random', "don't use entropy, use /dev/zero"), (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"), (r'^( *)\t', "don't use tabs to indent"), - (r'sed .*\'/[^/]*/i[^\\][^\n]', + (r'sed .*\'(\d+|/[^/]*/)i[^\\][^\n]', "put a backslash-escaped newline after sed 'i' command"), ], # warnings diff -r 5e4491c114b2 -r e97ce4a5afc5 tests/test-unionrepo.t --- a/tests/test-unionrepo.t Mon Apr 22 16:33:28 2013 -0500 +++ b/tests/test-unionrepo.t Mon Apr 22 16:50:08 2013 -0500 @@ -25,7 +25,8 @@ $ hg clone -q repo1 --rev 0 repo2 $ cd repo2 $ touch repo2-1 - $ sed '1irepo2-1 at top' f > f.tmp + $ sed '1i\ + > repo2-1 at top' f > f.tmp $ mv f.tmp f $ hg ci -Aqmrepo2-1 $ touch repo2-2