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