[PATCH] solaris: tests can't use tail -n
Danek Duvall
danek.duvall at oracle.com
Mon Aug 26 17:21:37 CDT 2013
# HG changeset patch
# User Danek Duvall <danek.duvall at oracle.com>
# Date 1377555644 25200
# Node ID 871cf1a5a705871efca2edf3e78c6bd70c16d20e
# Parent 98bfce1f5769084ddf0483e613381a3580d056ed
solaris: tests can't use tail -n
Solaris tail doesn't recognize the -n option. Replace the one use of it
with some inline python code, and add a test case to check-code.py.
diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -67,6 +67,7 @@ testpats = [
(r'echo -n', "don't use 'echo -n', use printf"),
(r'(^| )wc[^|]*$\n(?!.*\(re\))', "filter wc output"),
(r'head -c', "don't use 'head -c', use 'dd'"),
+ (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"),
diff --git a/tests/test-import-merge.t b/tests/test-import-merge.t
--- a/tests/test-import-merge.t
+++ b/tests/test-import-merge.t
@@ -129,7 +129,9 @@ Test that --exact on a bad header doesn'
$ echo a>>a
$ hg ci -m3
$ hg export 2 | head -7 > ../a.patch
- $ hg export tip | tail -n +8 >> ../a.patch
+ $ hg export tip > out
+ >>> apatch = open("../a.patch", "a")
+ >>> apatch.write("".join(open("out").readlines()[7:]))
$ cd ..
$ hg clone -qr0 repo3 repo3-clone
More information about the Mercurial-devel
mailing list