comparison mercurial/patch.py @ 23295:ac072c79bd9d

patch.diffopts: break get function into if statements We're going to add another condition here, and with the current structure that becomes just too confusing.
author Siddharth Agarwal <sid0@fb.com>
date Wed, 12 Nov 2014 23:44:17 -0800
parents c343557a8442
children 922fcfb02e77
comparison
equal deleted inserted replaced
23294:ec8c73b02e2e 23295:ac072c79bd9d
1557 1557
1558 class GitDiffRequired(Exception): 1558 class GitDiffRequired(Exception):
1559 pass 1559 pass
1560 1560
1561 def diffopts(ui, opts=None, untrusted=False, section='diff'): 1561 def diffopts(ui, opts=None, untrusted=False, section='diff'):
1562 def get(key, name=None, getter=ui.configbool): 1562 def get(key, name=None, getter=ui.configbool, forceplain=None):
1563 return ((opts and opts.get(key)) or 1563 if opts:
1564 getter(section, name or key, None, untrusted=untrusted)) 1564 v = opts.get(key)
1565 if v:
1566 return v
1567 return getter(section, name or key, None, untrusted=untrusted)
1568
1565 return mdiff.diffopts( 1569 return mdiff.diffopts(
1566 text=opts and opts.get('text'), 1570 text=opts and opts.get('text'),
1567 git=get('git'), 1571 git=get('git'),
1568 nodates=get('nodates'), 1572 nodates=get('nodates'),
1569 nobinary=get('nobinary'), 1573 nobinary=get('nobinary'),