Mercurial > hg
comparison tests/test-merge1.t @ 45894:9dc1351d0b5f
errors: raise ConfigError on failure to parse config file
This replaces two raises of `ParseError` by `ConfigError`, which makes
it so we get the desired exit code when `ui.detailed-exit-code` is
enabled. Because the exceptions include a location, I had to add that
to `ConfigError` as well. I considered making `ConfigError` a subclass
of `ParseError`, but it doesn't feel like it quite passes the "is-a"
test.
I used "config error: " as prefix for these errors instead of the
previous "hg: parse error: ", which seems a little less accurate now
(and, as I've said before, I don't know what the "hg: " part is
supposed to signify anyway). I can easily be convinced to change the
prefix to something else (including "abort: ").
Some of the exceptions raised here mean that we fail to even load the
`ui` object in the `dispatch` module. When that happens, we don't know
to use detailed exit codes, so some tests (e.g. `test-hgrc.t`) still
see exit code 255. I'll try to get back to that later. It should be
possible to give detailed exit codes if at least part of the config
can be read (e.g. when the system-wide one enables detailed exit codes
and the user's config fails to parse).
Differential Revision: https://phab.mercurial-scm.org/D9355
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 20 Nov 2020 14:43:21 -0800 |
parents | bff719525815 |
children | 721f765a34ac |
comparison
equal
deleted
inserted
replaced
45893:f4065c3f09b8 | 45894:9dc1351d0b5f |
---|---|
136 $ echo This is file b2 > b | 136 $ echo This is file b2 > b |
137 #endif | 137 #endif |
138 | 138 |
139 bad config | 139 bad config |
140 $ hg merge 1 --config merge.checkunknown=x | 140 $ hg merge 1 --config merge.checkunknown=x |
141 abort: merge.checkunknown not valid ('x' is none of 'abort', 'ignore', 'warn') | 141 config error: merge.checkunknown not valid ('x' is none of 'abort', 'ignore', 'warn') |
142 [30] | 142 [30] |
143 this merge should fail | 143 this merge should fail |
144 $ hg merge 1 --config merge.checkunknown=abort | 144 $ hg merge 1 --config merge.checkunknown=abort |
145 b: untracked file differs | 145 b: untracked file differs |
146 abort: untracked files in working directory differ from files in requested revision | 146 abort: untracked files in working directory differ from files in requested revision |