annotate tests/test-dispatch.t @ 36705:c6901665cd5b

py3: make sure __repr__ returns a str # skip-blame because just r'' prefix Differential Revision: https://phab.mercurial-scm.org/D2652
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 04 Mar 2018 22:40:33 +0530
parents 4441705b7111
children 0d703063d0c8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
1 test command parsing and dispatch
4563
8044be585b91 dispatch: restore a dropped shlex import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
2
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
3 $ hg init a
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
4 $ cd a
14115
1d5faa2c970f tests: move test-issue436 in test-dispatch where fancyopts is tested
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13967
diff changeset
5
1d5faa2c970f tests: move test-issue436 in test-dispatch where fancyopts is tested
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13967
diff changeset
6 Redundant options used to crash (issue436):
1d5faa2c970f tests: move test-issue436 in test-dispatch where fancyopts is tested
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13967
diff changeset
7 $ hg -v log -v
1d5faa2c970f tests: move test-issue436 in test-dispatch where fancyopts is tested
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13967
diff changeset
8 $ hg -v log -v x
1d5faa2c970f tests: move test-issue436 in test-dispatch where fancyopts is tested
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13967
diff changeset
9
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
10 $ echo a > a
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
11 $ hg ci -Ama
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
12 adding a
4563
8044be585b91 dispatch: restore a dropped shlex import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
13
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
14 Missing arg:
4621
6fc26982f203 dispatch: fix handling of incorrect number of arguments
Matt Mackall <mpm@selenic.com>
parents: 4563
diff changeset
15
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
16 $ hg cat
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
17 hg cat: invalid arguments
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
18 hg cat [OPTION]... FILE...
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
19
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
20 output the current or given revision of files
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
21
22117
c1d93edcf004 help: fold repeatable option message into option table header
Matt Mackall <mpm@selenic.com>
parents: 22111
diff changeset
22 options ([+] can be repeated):
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
23
15145
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14115
diff changeset
24 -o --output FORMAT print output to file with formatted name
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14115
diff changeset
25 -r --rev REV print the given revision
30152
d65e246100ed help: backout f3c4edfd35e1 (mark boolean flags with [no-] in help) for now
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30024
diff changeset
26 --decode apply any matching decode filter
15145
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14115
diff changeset
27 -I --include PATTERN [+] include names matching the given patterns
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14115
diff changeset
28 -X --exclude PATTERN [+] exclude names matching the given patterns
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
29
29974
7109d5ddeb0c help: use single quotes in use warning
timeless <timeless@mozdev.org>
parents: 22117
diff changeset
30 (use 'hg cat -h' to show more help)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12157
diff changeset
31 [255]
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
32
35027
7384250eabd9 dispatch: do not drop unpaired argument at _earlygetopt()
Yuya Nishihara <yuya@tcha.org>
parents: 34953
diff changeset
33 Missing parameter for early option:
7384250eabd9 dispatch: do not drop unpaired argument at _earlygetopt()
Yuya Nishihara <yuya@tcha.org>
parents: 34953
diff changeset
34
7384250eabd9 dispatch: do not drop unpaired argument at _earlygetopt()
Yuya Nishihara <yuya@tcha.org>
parents: 34953
diff changeset
35 $ hg log -R 2>&1 | grep 'hg log'
7384250eabd9 dispatch: do not drop unpaired argument at _earlygetopt()
Yuya Nishihara <yuya@tcha.org>
parents: 34953
diff changeset
36 hg log: option -R requires argument
7384250eabd9 dispatch: do not drop unpaired argument at _earlygetopt()
Yuya Nishihara <yuya@tcha.org>
parents: 34953
diff changeset
37 hg log [OPTION]... [FILE]
7384250eabd9 dispatch: do not drop unpaired argument at _earlygetopt()
Yuya Nishihara <yuya@tcha.org>
parents: 34953
diff changeset
38 (use 'hg log -h' to show more help)
7384250eabd9 dispatch: do not drop unpaired argument at _earlygetopt()
Yuya Nishihara <yuya@tcha.org>
parents: 34953
diff changeset
39
35226
5b569d512fbd fancyopts: use getopt.gnu_getopt()
Yuya Nishihara <yuya@tcha.org>
parents: 35223
diff changeset
40 "--" may be an option value:
5b569d512fbd fancyopts: use getopt.gnu_getopt()
Yuya Nishihara <yuya@tcha.org>
parents: 35223
diff changeset
41
5b569d512fbd fancyopts: use getopt.gnu_getopt()
Yuya Nishihara <yuya@tcha.org>
parents: 35223
diff changeset
42 $ hg -R -- log
35227
98a5aa5575e7 fancyopts: fix handling of "--" value in earlygetopt()
Yuya Nishihara <yuya@tcha.org>
parents: 35226
diff changeset
43 abort: repository -- not found!
35226
5b569d512fbd fancyopts: use getopt.gnu_getopt()
Yuya Nishihara <yuya@tcha.org>
parents: 35223
diff changeset
44 [255]
5b569d512fbd fancyopts: use getopt.gnu_getopt()
Yuya Nishihara <yuya@tcha.org>
parents: 35223
diff changeset
45 $ hg log -R --
35227
98a5aa5575e7 fancyopts: fix handling of "--" value in earlygetopt()
Yuya Nishihara <yuya@tcha.org>
parents: 35226
diff changeset
46 abort: repository -- not found!
35226
5b569d512fbd fancyopts: use getopt.gnu_getopt()
Yuya Nishihara <yuya@tcha.org>
parents: 35223
diff changeset
47 [255]
5b569d512fbd fancyopts: use getopt.gnu_getopt()
Yuya Nishihara <yuya@tcha.org>
parents: 35223
diff changeset
48 $ hg log -T --
5b569d512fbd fancyopts: use getopt.gnu_getopt()
Yuya Nishihara <yuya@tcha.org>
parents: 35223
diff changeset
49 -- (no-eol)
5b569d512fbd fancyopts: use getopt.gnu_getopt()
Yuya Nishihara <yuya@tcha.org>
parents: 35223
diff changeset
50 $ hg log -T -- -k nomatch
35027
7384250eabd9 dispatch: do not drop unpaired argument at _earlygetopt()
Yuya Nishihara <yuya@tcha.org>
parents: 34953
diff changeset
51
35029
e16f68c4abe3 dispatch: stop parsing of early boolean option at "--"
Yuya Nishihara <yuya@tcha.org>
parents: 35027
diff changeset
52 Parsing of early options should stop at "--":
e16f68c4abe3 dispatch: stop parsing of early boolean option at "--"
Yuya Nishihara <yuya@tcha.org>
parents: 35027
diff changeset
53
e16f68c4abe3 dispatch: stop parsing of early boolean option at "--"
Yuya Nishihara <yuya@tcha.org>
parents: 35027
diff changeset
54 $ hg cat -- --config=hooks.pre-cat=false
e16f68c4abe3 dispatch: stop parsing of early boolean option at "--"
Yuya Nishihara <yuya@tcha.org>
parents: 35027
diff changeset
55 --config=hooks.pre-cat=false: no such file in rev cb9a9f314b8b
e16f68c4abe3 dispatch: stop parsing of early boolean option at "--"
Yuya Nishihara <yuya@tcha.org>
parents: 35027
diff changeset
56 [1]
e16f68c4abe3 dispatch: stop parsing of early boolean option at "--"
Yuya Nishihara <yuya@tcha.org>
parents: 35027
diff changeset
57 $ hg cat -- --debugger
e16f68c4abe3 dispatch: stop parsing of early boolean option at "--"
Yuya Nishihara <yuya@tcha.org>
parents: 35027
diff changeset
58 --debugger: no such file in rev cb9a9f314b8b
e16f68c4abe3 dispatch: stop parsing of early boolean option at "--"
Yuya Nishihara <yuya@tcha.org>
parents: 35027
diff changeset
59 [1]
e16f68c4abe3 dispatch: stop parsing of early boolean option at "--"
Yuya Nishihara <yuya@tcha.org>
parents: 35027
diff changeset
60
35030
d9aba3730d30 dispatch: abort if early boolean options can't be parsed
Yuya Nishihara <yuya@tcha.org>
parents: 35029
diff changeset
61 Unparsable form of early options:
d9aba3730d30 dispatch: abort if early boolean options can't be parsed
Yuya Nishihara <yuya@tcha.org>
parents: 35029
diff changeset
62
d9aba3730d30 dispatch: abort if early boolean options can't be parsed
Yuya Nishihara <yuya@tcha.org>
parents: 35029
diff changeset
63 $ hg cat --debugg
d9aba3730d30 dispatch: abort if early boolean options can't be parsed
Yuya Nishihara <yuya@tcha.org>
parents: 35029
diff changeset
64 abort: option --debugger may not be abbreviated!
d9aba3730d30 dispatch: abort if early boolean options can't be parsed
Yuya Nishihara <yuya@tcha.org>
parents: 35029
diff changeset
65 [255]
d9aba3730d30 dispatch: abort if early boolean options can't be parsed
Yuya Nishihara <yuya@tcha.org>
parents: 35029
diff changeset
66
35034
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
67 Parsing failure of early options should be detected before executing the
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
68 command:
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
69
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
70 $ hg log -b '--config=hooks.pre-log=false' default
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
71 abort: option --config may not be abbreviated!
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
72 [255]
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
73 $ hg log -b -R. default
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
74 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
75 [255]
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
76 $ hg log --cwd .. -b --cwd=. default
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
77 abort: option --cwd may not be abbreviated!
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
78 [255]
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
79
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
80 However, we can't prevent it from loading extensions and configs:
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
81
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
82 $ cat <<EOF > bad.py
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
83 > raise Exception('bad')
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
84 > EOF
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
85 $ hg log -b '--config=extensions.bad=bad.py' default
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
86 *** failed to import extension bad from bad.py: bad
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
87 abort: option --config may not be abbreviated!
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
88 [255]
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
89
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
90 $ mkdir -p badrepo/.hg
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
91 $ echo 'invalid-syntax' > badrepo/.hg/hgrc
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
92 $ hg log -b -Rbadrepo default
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 35230
diff changeset
93 hg: parse error at badrepo/.hg/hgrc:1: invalid-syntax
35034
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
94 [255]
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
95
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
96 $ hg log -b --cwd=inexistent default
35230
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35227
diff changeset
97 abort: $ENOENT$: 'inexistent'
35034
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
98 [255]
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
99
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
100 $ hg log -b '--config=ui.traceback=yes' 2>&1 | grep '^Traceback'
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
101 Traceback (most recent call last):
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
102 $ hg log -b '--config=profiling.enabled=yes' 2>&1 | grep -i sample
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
103 Sample count: .*|No samples recorded\. (re)
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
104
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
105 Early options can't be specified in [aliases] and [defaults] because they are
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
106 applied before the command name is resolved:
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
107
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
108 $ hg log -b '--config=alias.log=log --config=hooks.pre-log=false'
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
109 hg log: option -b not recognized
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
110 error in definition for alias 'log': --config may only be given on the command
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
111 line
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
112 [255]
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
113
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
114 $ hg log -b '--config=defaults.log=--config=hooks.pre-log=false'
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
115 abort: option --config may not be abbreviated!
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
116 [255]
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
117
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
118 Shell aliases bypass any command parsing rules but for the early one:
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
119
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
120 $ hg log -b '--config=alias.log=!echo howdy'
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
121 howdy
02845f7441af dispatch: verify result of early command parsing
Yuya Nishihara <yuya@tcha.org>
parents: 35030
diff changeset
122
35170
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
123 Early options must come first if HGPLAIN=+strictflags is specified:
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
124 (BUG: chg cherry-picks early options to pass them as a server command)
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
125
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
126 #if no-chg
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
127 $ HGPLAIN=+strictflags hg log -b --config='hooks.pre-log=false' default
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
128 abort: unknown revision '--config=hooks.pre-log=false'!
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
129 [255]
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
130 $ HGPLAIN=+strictflags hg log -b -R. default
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
131 abort: unknown revision '-R.'!
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
132 [255]
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
133 $ HGPLAIN=+strictflags hg log -b --cwd=. default
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
134 abort: unknown revision '--cwd=.'!
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
135 [255]
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
136 #endif
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
137 $ HGPLAIN=+strictflags hg log -b --debugger default
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
138 abort: unknown revision '--debugger'!
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
139 [255]
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
140 $ HGPLAIN=+strictflags hg log -b --config='alias.log=!echo pwned' default
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
141 abort: unknown revision '--config=alias.log=!echo pwned'!
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
142 [255]
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
143
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
144 $ HGPLAIN=+strictflags hg log --config='hooks.pre-log=false' -b default
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
145 abort: option --config may not be abbreviated!
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
146 [255]
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
147 $ HGPLAIN=+strictflags hg log -q --cwd=.. -b default
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
148 abort: option --cwd may not be abbreviated!
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
149 [255]
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
150 $ HGPLAIN=+strictflags hg log -q -R . -b default
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
151 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
152 [255]
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
153
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
154 $ HGPLAIN=+strictflags hg --config='hooks.pre-log=false' log -b default
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
155 abort: pre-log hook exited with status 1
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
156 [255]
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
157 $ HGPLAIN=+strictflags hg --cwd .. -q -Ra log -b default
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
158 0:cb9a9f314b8b
35223
4edd2202f7d7 dispatch: alias --repo to --repository while parsing early options
Yuya Nishihara <yuya@tcha.org>
parents: 35205
diff changeset
159 $ HGPLAIN=+strictflags hg --cwd .. -q --repository a log -b default
4edd2202f7d7 dispatch: alias --repo to --repository while parsing early options
Yuya Nishihara <yuya@tcha.org>
parents: 35205
diff changeset
160 0:cb9a9f314b8b
4edd2202f7d7 dispatch: alias --repo to --repository while parsing early options
Yuya Nishihara <yuya@tcha.org>
parents: 35205
diff changeset
161 $ HGPLAIN=+strictflags hg --cwd .. -q --repo a log -b default
4edd2202f7d7 dispatch: alias --repo to --repository while parsing early options
Yuya Nishihara <yuya@tcha.org>
parents: 35205
diff changeset
162 0:cb9a9f314b8b
35170
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
163
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
164 For compatibility reasons, HGPLAIN=+strictflags is not enabled by plain HGPLAIN:
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
165
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
166 $ HGPLAIN= hg log --config='hooks.pre-log=false' -b default
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
167 abort: pre-log hook exited with status 1
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
168 [255]
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
169 $ HGPLAINEXCEPT= hg log --cwd .. -q -Ra -b default
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
170 0:cb9a9f314b8b
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 35034
diff changeset
171
4563
8044be585b91 dispatch: restore a dropped shlex import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
172 [defaults]
4621
6fc26982f203 dispatch: fix handling of incorrect number of arguments
Matt Mackall <mpm@selenic.com>
parents: 4563
diff changeset
173
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
174 $ hg cat a
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
175 a
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
176 $ cat >> $HGRCPATH <<EOF
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
177 > [defaults]
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
178 > cat = -r null
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
179 > EOF
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
180 $ hg cat a
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
181 a: no such file in rev 000000000000
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12157
diff changeset
182 [1]
4654
e0e73ba37983 Fix dispatch error message when not in a repo
Brendan Cully <brendan@kublai.com>
parents: 4621
diff changeset
183
17014
50fbe9063ff2 tests: convert some 'hghave no-outer-repo' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 15145
diff changeset
184 $ cd "$TESTTMP"
50fbe9063ff2 tests: convert some 'hghave no-outer-repo' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 15145
diff changeset
185
18506
ef60083b5536 tests: fix for windows - slashes and no serve
Mads Kiilerich <madski@unity3d.com>
parents: 18227
diff changeset
186 OSError "No such file or directory" / "The system cannot find the path
ef60083b5536 tests: fix for windows - slashes and no serve
Mads Kiilerich <madski@unity3d.com>
parents: 18227
diff changeset
187 specified" should include filename even when it is empty
18227
720308f741cb dispatch: show empty filename in OSError aborts
Mads Kiilerich <mads@kiilerich.com>
parents: 18226
diff changeset
188
720308f741cb dispatch: show empty filename in OSError aborts
Mads Kiilerich <mads@kiilerich.com>
parents: 18226
diff changeset
189 $ hg -R a archive ''
18506
ef60083b5536 tests: fix for windows - slashes and no serve
Mads Kiilerich <madski@unity3d.com>
parents: 18227
diff changeset
190 abort: *: '' (glob)
18227
720308f741cb dispatch: show empty filename in OSError aborts
Mads Kiilerich <mads@kiilerich.com>
parents: 18226
diff changeset
191 [255]
720308f741cb dispatch: show empty filename in OSError aborts
Mads Kiilerich <mads@kiilerich.com>
parents: 18226
diff changeset
192
17014
50fbe9063ff2 tests: convert some 'hghave no-outer-repo' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 15145
diff changeset
193 #if no-outer-repo
50fbe9063ff2 tests: convert some 'hghave no-outer-repo' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 15145
diff changeset
194
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
195 No repo:
4659
7a7d4937272b Kill trailing spaces
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4654
diff changeset
196
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
197 $ hg cat
13967
f85c9b0fdb32 dispatch: improve repository not found message
Matt Mackall <mpm@selenic.com>
parents: 13950
diff changeset
198 abort: no repository found in '$TESTTMP' (.hg not found)!
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12157
diff changeset
199 [255]
12157
88250a460bf8 tests: unify test-dispatch
Adrian Buehlmann <adrian@cadifra.com>
parents: 12028
diff changeset
200
17014
50fbe9063ff2 tests: convert some 'hghave no-outer-repo' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 15145
diff changeset
201 #endif
34643
f42dec9c976e hgweb: do not import uuid immediately to avoid its side effect
Jun Wu <quark@fb.com>
parents: 30152
diff changeset
202
f42dec9c976e hgweb: do not import uuid immediately to avoid its side effect
Jun Wu <quark@fb.com>
parents: 30152
diff changeset
203 #if rmcwd
f42dec9c976e hgweb: do not import uuid immediately to avoid its side effect
Jun Wu <quark@fb.com>
parents: 30152
diff changeset
204
f42dec9c976e hgweb: do not import uuid immediately to avoid its side effect
Jun Wu <quark@fb.com>
parents: 30152
diff changeset
205 Current directory removed:
f42dec9c976e hgweb: do not import uuid immediately to avoid its side effect
Jun Wu <quark@fb.com>
parents: 30152
diff changeset
206
f42dec9c976e hgweb: do not import uuid immediately to avoid its side effect
Jun Wu <quark@fb.com>
parents: 30152
diff changeset
207 $ mkdir $TESTTMP/repo1
f42dec9c976e hgweb: do not import uuid immediately to avoid its side effect
Jun Wu <quark@fb.com>
parents: 30152
diff changeset
208 $ cd $TESTTMP/repo1
f42dec9c976e hgweb: do not import uuid immediately to avoid its side effect
Jun Wu <quark@fb.com>
parents: 30152
diff changeset
209 $ rm -rf $TESTTMP/repo1
34953
0ccb43d4cf01 test-dispatch: stabilize the test
Jun Wu <quark@fb.com>
parents: 34789
diff changeset
210
0ccb43d4cf01 test-dispatch: stabilize the test
Jun Wu <quark@fb.com>
parents: 34789
diff changeset
211 The output could be one of the following and something else:
0ccb43d4cf01 test-dispatch: stabilize the test
Jun Wu <quark@fb.com>
parents: 34789
diff changeset
212 chg: abort: failed to getcwd (errno = *) (glob)
0ccb43d4cf01 test-dispatch: stabilize the test
Jun Wu <quark@fb.com>
parents: 34789
diff changeset
213 abort: error getting current working directory: * (glob)
35230
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35227
diff changeset
214 sh: 0: getcwd() failed: $ENOENT$
34953
0ccb43d4cf01 test-dispatch: stabilize the test
Jun Wu <quark@fb.com>
parents: 34789
diff changeset
215 Since the exact behavior depends on the shell, only check it returns non-zero.
0ccb43d4cf01 test-dispatch: stabilize the test
Jun Wu <quark@fb.com>
parents: 34789
diff changeset
216 $ HGDEMANDIMPORT=disable hg version -q 2>/dev/null || false
0ccb43d4cf01 test-dispatch: stabilize the test
Jun Wu <quark@fb.com>
parents: 34789
diff changeset
217 [1]
34643
f42dec9c976e hgweb: do not import uuid immediately to avoid its side effect
Jun Wu <quark@fb.com>
parents: 30152
diff changeset
218
f42dec9c976e hgweb: do not import uuid immediately to avoid its side effect
Jun Wu <quark@fb.com>
parents: 30152
diff changeset
219 #endif