Debian Codegraph @

tests/test-check-help.t

raw
1 #require test-repo
2
3 $ . "$TESTDIR/helpers-testrepo.sh"
4
5 $ cat <<'EOF' > scanhelptopics.py
6 > import re
7 > import sys
8 > if sys.platform == "win32":
9 > import msvcrt
10 > import os
11 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
12 > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
13 > topics = set()
14 > topicre = re.compile(br':hg:`help ([a-z0-9\-.]+)`')
15 > for fname in sys.argv:
16 > with open(fname, 'rb') as f:
17 > topics.update(m.group(1) for m in topicre.finditer(f.read()))
18 > for s in sorted(topics):
19 > stdout.write(b'%s\n' % s)
20 > EOF
21
22 Check if ":hg:`help TOPIC`" is valid:
23 (use "xargs -n1 -t" to see which help commands are executed)
24
25 $ cd "$TESTDIR"/..
26 $ testrepohg files 'glob:{hgdemandimport,hgext,mercurial}/**/*.py' \
27 > | sed 's|\\|/|g' \
28 > | xargs "$PYTHON" "$TESTTMP/scanhelptopics.py" \
29 > | xargs -n1 hg --cwd "$TESTTMP" help --config extensions.phabricator= > /dev/null