##// END OF EJS Templates
py3: use bytes stdout in test-check-help.t...
Matt Harbison -
r41036:b6c610bf default
parent child Browse files
Show More
@@ -1,30 +1,31 b''
1 #require test-repo
1 #require test-repo
2
2
3 $ . "$TESTDIR/helpers-testrepo.sh"
3 $ . "$TESTDIR/helpers-testrepo.sh"
4
4
5 $ cat <<'EOF' > scanhelptopics.py
5 $ cat <<'EOF' > scanhelptopics.py
6 > from __future__ import absolute_import, print_function
6 > from __future__ import absolute_import, print_function
7 > import re
7 > import re
8 > import sys
8 > import sys
9 > if sys.platform == "win32":
9 > if sys.platform == "win32":
10 > import msvcrt
10 > import msvcrt
11 > import os
11 > import os
12 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
12 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
13 > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
13 > topics = set()
14 > topics = set()
14 > topicre = re.compile(br':hg:`help ([a-z0-9\-.]+)`')
15 > topicre = re.compile(br':hg:`help ([a-z0-9\-.]+)`')
15 > for fname in sys.argv:
16 > for fname in sys.argv:
16 > with open(fname, 'rb') as f:
17 > with open(fname, 'rb') as f:
17 > topics.update(m.group(1) for m in topicre.finditer(f.read()))
18 > topics.update(m.group(1) for m in topicre.finditer(f.read()))
18 > for s in sorted(topics):
19 > for s in sorted(topics):
19 > print(s)
20 > stdout.write(b'%s\n' % s)
20 > EOF
21 > EOF
21
22
22 $ cd "$TESTDIR"/..
23 $ cd "$TESTDIR"/..
23
24
24 Check if ":hg:`help TOPIC`" is valid:
25 Check if ":hg:`help TOPIC`" is valid:
25 (use "xargs -n1 -t" to see which help commands are executed)
26 (use "xargs -n1 -t" to see which help commands are executed)
26
27
27 $ testrepohg files 'glob:{hgdemandimport,hgext,mercurial}/**/*.py' \
28 $ testrepohg files 'glob:{hgdemandimport,hgext,mercurial}/**/*.py' \
28 > | sed 's|\\|/|g' \
29 > | sed 's|\\|/|g' \
29 > | xargs "$PYTHON" "$TESTTMP/scanhelptopics.py" \
30 > | xargs "$PYTHON" "$TESTTMP/scanhelptopics.py" \
30 > | xargs -n1 hg help --config extensions.phabricator= > /dev/null
31 > | xargs -n1 hg help --config extensions.phabricator= > /dev/null
General Comments 0
You need to be logged in to leave comments. Login now