comparison tests/test-fix.t @ 40564:0df4d93fdc27

tests: replace `tac` reimplementation by `sort -r` `sort -r` is better code "formatter" than `tac` since it's stable. It's also portable so we don't need to reimplement it in Python. Differential Revision: https://phab.mercurial-scm.org/D5239
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 07 Nov 2018 10:29:38 -0800
parents 2ad56a9b983b
children b9557567cc3f
comparison
equal deleted inserted replaced
40563:2ad56a9b983b 40564:0df4d93fdc27
1 A script that implements uppercasing of specific lines in a file. This 1 A script that implements uppercasing of specific lines in a file. This
2 approximates the behavior of code formatters well enough for our tests. 2 approximates the behavior of code formatters well enough for our tests.
3 3
4 $ TAC="$TESTTMP/tac.py"
5 $ cat > $TAC <<EOF
6 > import sys
7 > print('\n'.join(sys.stdin.read().splitlines()[::-1]))
8 > EOF
9 $ UPPERCASEPY="$TESTTMP/uppercase.py" 4 $ UPPERCASEPY="$TESTTMP/uppercase.py"
10 $ cat > $UPPERCASEPY <<EOF 5 $ cat > $UPPERCASEPY <<EOF
11 > import sys 6 > import sys
12 > from mercurial.utils.procutil import setbinary 7 > from mercurial.utils.procutil import setbinary
13 > setbinary(sys.stdin) 8 > setbinary(sys.stdin)
1120 1115
1121 $ printf "foo\n" > foo.whole 1116 $ printf "foo\n" > foo.whole
1122 $ printf "first\nsecond\n" > bar.txt 1117 $ printf "first\nsecond\n" > bar.txt
1123 $ hg add -q 1118 $ hg add -q
1124 $ hg fix -w --config fix.sometool:fileset=bar.txt \ 1119 $ hg fix -w --config fix.sometool:fileset=bar.txt \
1125 > --config fix.sometool:command="$PYTHON $TAC" 1120 > --config fix.sometool:command="sort -r"
1126 the fix.tool:fileset config name is deprecated; please rename it to fix.tool:pattern 1121 the fix.tool:fileset config name is deprecated; please rename it to fix.tool:pattern
1127 1122
1128 $ cat foo.whole 1123 $ cat foo.whole
1129 FOO 1124 FOO
1130 $ cat bar.txt 1125 $ cat bar.txt