# HG changeset patch # User Martin von Zweigbergk # Date 2020-11-23 18:38:05 # Node ID db5dddb38f5b95e626d6659f3e4be7e0c7403693 # Parent 6cc269bd1c29bcac34a01dc73d0cf34b599678d2 errors: raise InputError on early parse error in dispatch I didn't think this would have any effect on the tests, but it does because the catching in `scmutil.callcatch()` still happens. That's because `dispatch` passes in the function that includes the parsing as an argument to that function. I initially used `ConfigError` here but Matt Harbison convinced me to use `InputError`. I think that makes sense since error is not in a config file. Differential Revision: https://phab.mercurial-scm.org/D9387 diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -849,7 +849,7 @@ def _parseconfig(ui, config): ui.setconfig(section, name, value, b'--config') configs.append((section, name, value)) except (IndexError, ValueError): - raise error.Abort( + raise error.InputError( _( b'malformed --config option: %r ' b'(use --config section.name=value)' diff --git a/tests/test-globalopts.t b/tests/test-globalopts.t --- a/tests/test-globalopts.t +++ b/tests/test-globalopts.t @@ -217,19 +217,19 @@ Testing --config: quuxfoo $ hg --cwd c --config '' tip -q abort: malformed --config option: '' (use --config section.name=value) - [255] + [10] $ hg --cwd c --config a.b tip -q abort: malformed --config option: 'a.b' (use --config section.name=value) - [255] + [10] $ hg --cwd c --config a tip -q abort: malformed --config option: 'a' (use --config section.name=value) - [255] + [10] $ hg --cwd c --config a.= tip -q abort: malformed --config option: 'a.=' (use --config section.name=value) - [255] + [10] $ hg --cwd c --config .b= tip -q abort: malformed --config option: '.b=' (use --config section.name=value) - [255] + [10] Testing --debug: