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.
--- a/contrib/check-code.py Fri Aug 23 16:05:38 2013 -0700
+++ b/contrib/check-code.py Mon Aug 26 15:20:44 2013 -0700
@@ -67,6 +67,7 @@
(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"),
--- a/tests/test-import-merge.t Fri Aug 23 16:05:38 2013 -0700
+++ b/tests/test-import-merge.t Mon Aug 26 15:20:44 2013 -0700
@@ -129,7 +129,9 @@
$ 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