D2623: dispatch: adding config items for overriding flag defaults
rdamazio (Rodrigo Damazio Bovendorp)
phabricator at mercurial-scm.org
Sun Mar 4 11:34:23 EST 2018
rdamazio added inline comments.
INLINE COMMENTS
> yuja wrote in dispatch.py:624
> Maybe this type conversion can be a `fancyopt.customopt` method since we've
> refactored the default handling by https://phab.mercurial-scm.org/D2090?
>
> # no idea if _defaultopt() should be made public or the whole commands.default handling
> # should be moved to fancyopts
> x = fancyopts._defaultopt(olddefault)
> newdefault = x.configdefault(ui, cmd, optname, ...)
>
> @dploch, any suggestions?
The issue is that customopt (and all its children) assume the value type is already the correct one, and thus do not perform any conversion. Since we're parsing values from the config file, the conversion is desired to ensure they don't all end up as text - the config{bool,int,etc} methods called by configtyped perform the proper conversion. In most cases (all commands that declare default values) no conversio is needed since those already have the correct type.
> yuja wrote in ui.py:390
> Perhaps this is noop since `[commands]` is removed at all if `ui.plain()` returns True.
You're right, I had the plain logic inverted in my head. Removed.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2623
To: rdamazio, #hg-reviewers, yuja
Cc: dploch, mercurial-devel
More information about the Mercurial-devel
mailing list