14 from . import ( |
14 from . import ( |
15 mdiff, |
15 mdiff, |
16 pycompat, |
16 pycompat, |
17 ) |
17 ) |
18 |
18 |
19 def diffallopts(ui, opts=None, untrusted=False, section='diff'): |
19 def diffallopts(ui, opts=None, untrusted=False, section='diff', |
|
20 configprefix=''): |
20 '''return diffopts with all features supported and parsed''' |
21 '''return diffopts with all features supported and parsed''' |
21 return difffeatureopts(ui, opts=opts, untrusted=untrusted, section=section, |
22 return difffeatureopts(ui, opts=opts, untrusted=untrusted, section=section, |
22 git=True, whitespace=True, formatchanging=True) |
23 git=True, whitespace=True, formatchanging=True, |
|
24 configprefix=configprefix) |
23 |
25 |
24 def difffeatureopts(ui, opts=None, untrusted=False, section='diff', git=False, |
26 def difffeatureopts(ui, opts=None, untrusted=False, section='diff', git=False, |
25 whitespace=False, formatchanging=False): |
27 whitespace=False, formatchanging=False, configprefix=''): |
26 '''return diffopts with only opted-in features parsed |
28 '''return diffopts with only opted-in features parsed |
27 |
29 |
28 Features: |
30 Features: |
29 - git: git-style diffs |
31 - git: git-style diffs |
30 - whitespace: whitespace options like ignoreblanklines and ignorews |
32 - whitespace: whitespace options like ignoreblanklines and ignorews |
43 # True, or False. |
45 # True, or False. |
44 if v or isinstance(v, bool): |
46 if v or isinstance(v, bool): |
45 return v |
47 return v |
46 if forceplain is not None and ui.plain(): |
48 if forceplain is not None and ui.plain(): |
47 return forceplain |
49 return forceplain |
48 return getter(section, name or key, untrusted=untrusted) |
50 return getter(section, configprefix + (name or key), |
|
51 untrusted=untrusted) |
49 |
52 |
50 # core options, expected to be understood by every diff parser |
53 # core options, expected to be understood by every diff parser |
51 buildopts = { |
54 buildopts = { |
52 'nodates': get('nodates'), |
55 'nodates': get('nodates'), |
53 'showfunc': get('show_function', 'showfunc'), |
56 'showfunc': get('show_function', 'showfunc'), |