[PATCH STABLE] test-annotate: rewrite sed with some python
Yuya Nishihara
yuya at tcha.org
Sun Mar 4 18:24:20 UTC 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1520187545 18000
# Sun Mar 04 13:19:05 2018 -0500
# Branch stable
# Node ID 0c042b499ba989d193783a5cd64cca866ce01ae8
# Parent b394778b1a5042ca5799f5bae43620dd3324c797
test-annotate: rewrite sed with some python
I hope this will fix the test failure seen on FreeBSD and Windows.
diff --git a/tests/test-annotate.t b/tests/test-annotate.t
--- a/tests/test-annotate.t
+++ b/tests/test-annotate.t
@@ -901,9 +901,12 @@ Annotate with orphaned CR (issue5798)
$ hg init repo-cr
$ cd repo-cr
- $ substcr() {
- > sed 's/\r/[CR]/g'
- > }
+ $ cat <<'EOF' >> "$TESTTMP/substcr.py"
+ > import sys
+ > stdin = getattr(sys.stdin, 'buffer', sys.stdin)
+ > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
+ > stdout.write(stdin.read().replace(b'\r', b'[CR]'))
+ > EOF
>>> with open('a', 'wb') as f:
... f.write(b'0a\r0b\r\n0c\r0d\r\n0e\n0f\n0g')
@@ -912,13 +915,13 @@ Annotate with orphaned CR (issue5798)
... f.write(b'0a\r0b\r\n1c\r1d\r\n0e\n1f\n0g')
$ hg ci -m1
- $ hg annotate -r0 a | substcr
+ $ hg annotate -r0 a | $PYTHON "$TESTTMP/substcr.py"
0: 0a[CR]0b[CR]
0: 0c[CR]0d[CR]
0: 0e
0: 0f
0: 0g
- $ hg annotate -r1 a | substcr
+ $ hg annotate -r1 a | $PYTHON "$TESTTMP/substcr.py"
0: 0a[CR]0b[CR]
1: 1c[CR]1d[CR]
0: 0e
More information about the Mercurial-devel
mailing list