##// END OF EJS Templates
patch.difffeatureopts: add a feature for whitespace diffopts...
Siddharth Agarwal -
r23433:41dd76b3 default
parent child Browse files
Show More
@@ -1560,15 +1560,18 class GitDiffRequired(Exception):
1560
1560
1561 def diffallopts(ui, opts=None, untrusted=False, section='diff'):
1561 def diffallopts(ui, opts=None, untrusted=False, section='diff'):
1562 '''return diffopts with all features supported and parsed'''
1562 '''return diffopts with all features supported and parsed'''
1563 return difffeatureopts(ui, opts=opts, untrusted=untrusted, section=section)
1563 return difffeatureopts(ui, opts=opts, untrusted=untrusted, section=section,
1564 git=True, whitespace=True)
1564
1565
1565 diffopts = diffallopts
1566 diffopts = diffallopts
1566
1567
1567 def difffeatureopts(ui, opts=None, untrusted=False, section='diff', git=False):
1568 def difffeatureopts(ui, opts=None, untrusted=False, section='diff', git=False,
1569 whitespace=False):
1568 '''return diffopts with only opted-in features parsed
1570 '''return diffopts with only opted-in features parsed
1569
1571
1570 Features:
1572 Features:
1571 - git: git-style diffs
1573 - git: git-style diffs
1574 - whitespace: whitespace options like ignoreblanklines and ignorews
1572 '''
1575 '''
1573 def get(key, name=None, getter=ui.configbool, forceplain=None):
1576 def get(key, name=None, getter=ui.configbool, forceplain=None):
1574 if opts:
1577 if opts:
@@ -1585,14 +1588,17 def difffeatureopts(ui, opts=None, untru
1585 'nobinary': get('nobinary'),
1588 'nobinary': get('nobinary'),
1586 'noprefix': get('noprefix', forceplain=False),
1589 'noprefix': get('noprefix', forceplain=False),
1587 'showfunc': get('show_function', 'showfunc'),
1590 'showfunc': get('show_function', 'showfunc'),
1588 'ignorews': get('ignore_all_space', 'ignorews'),
1589 'ignorewsamount': get('ignore_space_change', 'ignorewsamount'),
1590 'ignoreblanklines': get('ignore_blank_lines', 'ignoreblanklines'),
1591 'context': get('unified', getter=ui.config),
1591 'context': get('unified', getter=ui.config),
1592 }
1592 }
1593
1593
1594 if git:
1594 if git:
1595 buildopts['git'] = get('git')
1595 buildopts['git'] = get('git')
1596 if whitespace:
1597 buildopts['ignorews'] = get('ignore_all_space', 'ignorews')
1598 buildopts['ignorewsamount'] = get('ignore_space_change',
1599 'ignorewsamount')
1600 buildopts['ignoreblanklines'] = get('ignore_blank_lines',
1601 'ignoreblanklines')
1596
1602
1597 return mdiff.diffopts(**buildopts)
1603 return mdiff.diffopts(**buildopts)
1598
1604
General Comments 0
You need to be logged in to leave comments. Login now