Mercurial > hg
annotate tests/test-check-help.t @ 39319:862d23bc5749
perf: add function for obtaining manifest revision
This will use the modern API if available or fall back to the
legacy direct revlog access case. Without this, the perf command
won't work on all code bases.
Differential Revision: https://phab.mercurial-scm.org/D4391
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 27 Aug 2018 08:58:25 -0700 |
parents | 80e5210df25c |
children | d2c81e83de2a |
rev | line source |
---|---|
30880
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
1 #require test-repo |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
2 |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
3 $ . "$TESTDIR/helpers-testrepo.sh" |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
4 |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
5 $ cat <<'EOF' > scanhelptopics.py |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
6 > from __future__ import absolute_import, print_function |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
7 > import re |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
8 > import sys |
31498
a248bbfa0bc7
test-check-help: fix to work on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
30880
diff
changeset
|
9 > if sys.platform == "win32": |
a248bbfa0bc7
test-check-help: fix to work on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
30880
diff
changeset
|
10 > import os, msvcrt |
a248bbfa0bc7
test-check-help: fix to work on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
30880
diff
changeset
|
11 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) |
30880
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
12 > topics = set() |
35947
a36d3c8a0e41
py3: add b'' prefixes to string literals in test files
Pulkit Goyal <7895pulkit@gmail.com>
parents:
33204
diff
changeset
|
13 > topicre = re.compile(br':hg:`help ([a-z0-9\-.]+)`') |
30880
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
14 > for fname in sys.argv: |
35949
80e5210df25c
py3: make sure we open the file in bytes mode
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35947
diff
changeset
|
15 > with open(fname, 'rb') as f: |
30880
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
16 > topics.update(m.group(1) for m in topicre.finditer(f.read())) |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
17 > for s in sorted(topics): |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
18 > print(s) |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
19 > EOF |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
20 |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
21 $ cd "$TESTDIR"/.. |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
22 |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
23 Check if ":hg:`help TOPIC`" is valid: |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
24 (use "xargs -n1 -t" to see which help commands are executed) |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
25 |
33204
ddd65b4f3ae6
tests: alias syshg and syshgenv so they can be switched conditionally
Yuya Nishihara <yuya@tcha.org>
parents:
33116
diff
changeset
|
26 $ testrepohg files 'glob:{hgdemandimport,hgext,mercurial}/**/*.py' \ |
33116
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
32940
diff
changeset
|
27 > | sed 's|\\|/|g' \ |
32940
75be14993fda
cleanup: use $PYTHON to run python in many more tests
Augie Fackler <augie@google.com>
parents:
32421
diff
changeset
|
28 > | xargs $PYTHON "$TESTTMP/scanhelptopics.py" \ |
30880
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
29 > | xargs -n1 hg help > /dev/null |