comparison mercurial/patch.py @ 23296:922fcfb02e77

patch.diffopts: allow a setting to be forced in plain mode Upcoming patches will add an option that will almost certainly break diff output parsers when enabled. Add support for forcing an option to something in plain mode, as a fallback. Options passed in via the CLI are not affected, though -- it is assumed that any script passing the option in explicitly knows what it is doing.
author Siddharth Agarwal <sid0@fb.com>
date Wed, 12 Nov 2014 23:47:25 -0800
parents ac072c79bd9d
children d7abae94a7a0
comparison
equal deleted inserted replaced
23295:ac072c79bd9d 23296:922fcfb02e77
1562 def get(key, name=None, getter=ui.configbool, forceplain=None): 1562 def get(key, name=None, getter=ui.configbool, forceplain=None):
1563 if opts: 1563 if opts:
1564 v = opts.get(key) 1564 v = opts.get(key)
1565 if v: 1565 if v:
1566 return v 1566 return v
1567 if forceplain is not None and ui.plain():
1568 return forceplain
1567 return getter(section, name or key, None, untrusted=untrusted) 1569 return getter(section, name or key, None, untrusted=untrusted)
1568 1570
1569 return mdiff.diffopts( 1571 return mdiff.diffopts(
1570 text=opts and opts.get('text'), 1572 text=opts and opts.get('text'),
1571 git=get('git'), 1573 git=get('git'),