##// END OF EJS Templates
test-annotate: rewrite sed with some python...
Yuya Nishihara -
r36723:9a08f7d1 stable
parent child Browse files
Show More
@@ -901,9 +901,12 b' Annotate with orphaned CR (issue5798)'
901 $ hg init repo-cr
901 $ hg init repo-cr
902 $ cd repo-cr
902 $ cd repo-cr
903
903
904 $ substcr() {
904 $ cat <<'EOF' >> "$TESTTMP/substcr.py"
905 > sed 's/\r/[CR]/g'
905 > import sys
906 > }
906 > stdin = getattr(sys.stdin, 'buffer', sys.stdin)
907 > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
908 > stdout.write(stdin.read().replace(b'\r', b'[CR]'))
909 > EOF
907
910
908 >>> with open('a', 'wb') as f:
911 >>> with open('a', 'wb') as f:
909 ... f.write(b'0a\r0b\r\n0c\r0d\r\n0e\n0f\n0g')
912 ... f.write(b'0a\r0b\r\n0c\r0d\r\n0e\n0f\n0g')
@@ -912,13 +915,13 b' Annotate with orphaned CR (issue5798)'
912 ... f.write(b'0a\r0b\r\n1c\r1d\r\n0e\n1f\n0g')
915 ... f.write(b'0a\r0b\r\n1c\r1d\r\n0e\n1f\n0g')
913 $ hg ci -m1
916 $ hg ci -m1
914
917
915 $ hg annotate -r0 a | substcr
918 $ hg annotate -r0 a | $PYTHON "$TESTTMP/substcr.py"
916 0: 0a[CR]0b[CR]
919 0: 0a[CR]0b[CR]
917 0: 0c[CR]0d[CR]
920 0: 0c[CR]0d[CR]
918 0: 0e
921 0: 0e
919 0: 0f
922 0: 0f
920 0: 0g
923 0: 0g
921 $ hg annotate -r1 a | substcr
924 $ hg annotate -r1 a | $PYTHON "$TESTTMP/substcr.py"
922 0: 0a[CR]0b[CR]
925 0: 0a[CR]0b[CR]
923 1: 1c[CR]1d[CR]
926 1: 1c[CR]1d[CR]
924 0: 0e
927 0: 0e
General Comments 0
You need to be logged in to leave comments. Login now