diff: when looking for diff configs, support a configurable prefix
In a future commit, I want to make it possible to have the diff options pulled
from (as an example) `commands.commit.interactive.ignorews`; previously we only
supported this for customizable sections (so this would have needed a
`commit-interactive` section and been named `commit-interactive.ignorews`, which
felt a bit weird.
Differential Revision: https://phab.mercurial-scm.org/D5833
--- a/mercurial/diffutil.py Thu Jan 31 14:27:25 2019 -0800
+++ b/mercurial/diffutil.py Thu Jan 31 14:29:24 2019 -0800
@@ -16,13 +16,15 @@
pycompat,
)
-def diffallopts(ui, opts=None, untrusted=False, section='diff'):
+def diffallopts(ui, opts=None, untrusted=False, section='diff',
+ configprefix=''):
'''return diffopts with all features supported and parsed'''
return difffeatureopts(ui, opts=opts, untrusted=untrusted, section=section,
- git=True, whitespace=True, formatchanging=True)
+ git=True, whitespace=True, formatchanging=True,
+ configprefix=configprefix)
def difffeatureopts(ui, opts=None, untrusted=False, section='diff', git=False,
- whitespace=False, formatchanging=False):
+ whitespace=False, formatchanging=False, configprefix=''):
'''return diffopts with only opted-in features parsed
Features:
@@ -45,7 +47,8 @@
return v
if forceplain is not None and ui.plain():
return forceplain
- return getter(section, name or key, untrusted=untrusted)
+ return getter(section, configprefix + (name or key),
+ untrusted=untrusted)
# core options, expected to be understood by every diff parser
buildopts = {