##// END OF EJS Templates
errors: raise InputError on bad top-level flags...
Martin von Zweigbergk -
r46530:ac565222 default
parent child Browse files
Show More
@@ -1058,18 +1058,20 b' def _dispatch(req):'
1058 1058 req.canonical_command = cmd
1059 1059
1060 1060 if options[b"config"] != req.earlyoptions[b"config"]:
1061 raise error.Abort(_(b"option --config may not be abbreviated"))
1061 raise error.InputError(_(b"option --config may not be abbreviated"))
1062 1062 if options[b"cwd"] != req.earlyoptions[b"cwd"]:
1063 raise error.Abort(_(b"option --cwd may not be abbreviated"))
1063 raise error.InputError(_(b"option --cwd may not be abbreviated"))
1064 1064 if options[b"repository"] != req.earlyoptions[b"repository"]:
1065 raise error.Abort(
1065 raise error.InputError(
1066 1066 _(
1067 1067 b"option -R has to be separated from other options (e.g. not "
1068 1068 b"-qR) and --repository may only be abbreviated as --repo"
1069 1069 )
1070 1070 )
1071 1071 if options[b"debugger"] != req.earlyoptions[b"debugger"]:
1072 raise error.Abort(_(b"option --debugger may not be abbreviated"))
1072 raise error.InputError(
1073 _(b"option --debugger may not be abbreviated")
1074 )
1073 1075 # don't validate --profile/--traceback, which can be enabled from now
1074 1076
1075 1077 if options[b"encoding"]:
@@ -63,20 +63,20 b' Unparsable form of early options:'
63 63
64 64 $ hg cat --debugg
65 65 abort: option --debugger may not be abbreviated
66 [255]
66 [10]
67 67
68 68 Parsing failure of early options should be detected before executing the
69 69 command:
70 70
71 71 $ hg log -b '--config=hooks.pre-log=false' default
72 72 abort: option --config may not be abbreviated
73 [255]
73 [10]
74 74 $ hg log -b -R. default
75 75 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo
76 [255]
76 [10]
77 77 $ hg log --cwd .. -b --cwd=. default
78 78 abort: option --cwd may not be abbreviated
79 [255]
79 [10]
80 80
81 81 However, we can't prevent it from loading extensions and configs:
82 82
@@ -86,7 +86,7 b" However, we can't prevent it from loadin"
86 86 $ hg log -b '--config=extensions.bad=bad.py' default
87 87 *** failed to import extension bad from bad.py: bad
88 88 abort: option --config may not be abbreviated
89 [255]
89 [10]
90 90
91 91 $ mkdir -p badrepo/.hg
92 92 $ echo 'invalid-syntax' > badrepo/.hg/hgrc
@@ -114,7 +114,7 b' applied before the command name is resol'
114 114
115 115 $ hg log -b '--config=defaults.log=--config=hooks.pre-log=false'
116 116 abort: option --config may not be abbreviated
117 [255]
117 [10]
118 118
119 119 Shell aliases bypass any command parsing rules but for the early one:
120 120
@@ -144,13 +144,13 b' Early options must come first if HGPLAIN'
144 144
145 145 $ HGPLAIN=+strictflags hg log --config='hooks.pre-log=false' -b default
146 146 abort: option --config may not be abbreviated
147 [255]
147 [10]
148 148 $ HGPLAIN=+strictflags hg log -q --cwd=.. -b default
149 149 abort: option --cwd may not be abbreviated
150 [255]
150 [10]
151 151 $ HGPLAIN=+strictflags hg log -q -R . -b default
152 152 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo
153 [255]
153 [10]
154 154
155 155 $ HGPLAIN=+strictflags hg --config='hooks.pre-log=false' log -b default
156 156 abort: pre-log hook exited with status 1
@@ -135,22 +135,22 b' earlygetopt with illegal abbreviations:'
135 135
136 136 $ hg --confi "foo.bar=baz"
137 137 abort: option --config may not be abbreviated
138 [255]
138 [10]
139 139 $ hg --cw a tip
140 140 abort: option --cwd may not be abbreviated
141 [255]
141 [10]
142 142 $ hg --rep a tip
143 143 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo
144 [255]
144 [10]
145 145 $ hg --repositor a tip
146 146 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo
147 [255]
147 [10]
148 148 $ hg -qR a tip
149 149 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo
150 [255]
150 [10]
151 151 $ hg -qRa tip
152 152 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo
153 [255]
153 [10]
154 154
155 155 Testing --cwd:
156 156
General Comments 0
You need to be logged in to leave comments. Login now