Mercurial > hg-stable
changeset 23433:41dd76b3facb
patch.difffeatureopts: add a feature for whitespace diffopts
These aren't exactly format-breaking features -- just ones for which patches
applied to a repo will produce incorrect commits, In any case, some commands
like record and annotate only care about this feature.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Tue, 18 Nov 2014 17:09:26 -0800 |
parents | 27af986a332b |
children | 60300a4c0ae5 |
files | mercurial/patch.py |
diffstat | 1 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/patch.py Tue Nov 18 17:10:14 2014 -0800 +++ b/mercurial/patch.py Tue Nov 18 17:09:26 2014 -0800 @@ -1560,15 +1560,18 @@ def diffallopts(ui, opts=None, untrusted=False, section='diff'): '''return diffopts with all features supported and parsed''' - return difffeatureopts(ui, opts=opts, untrusted=untrusted, section=section) + return difffeatureopts(ui, opts=opts, untrusted=untrusted, section=section, + git=True, whitespace=True) diffopts = diffallopts -def difffeatureopts(ui, opts=None, untrusted=False, section='diff', git=False): +def difffeatureopts(ui, opts=None, untrusted=False, section='diff', git=False, + whitespace=False): '''return diffopts with only opted-in features parsed Features: - git: git-style diffs + - whitespace: whitespace options like ignoreblanklines and ignorews ''' def get(key, name=None, getter=ui.configbool, forceplain=None): if opts: @@ -1585,14 +1588,17 @@ 'nobinary': get('nobinary'), 'noprefix': get('noprefix', forceplain=False), 'showfunc': get('show_function', 'showfunc'), - 'ignorews': get('ignore_all_space', 'ignorews'), - 'ignorewsamount': get('ignore_space_change', 'ignorewsamount'), - 'ignoreblanklines': get('ignore_blank_lines', 'ignoreblanklines'), 'context': get('unified', getter=ui.config), } if git: buildopts['git'] = get('git') + if whitespace: + buildopts['ignorews'] = get('ignore_all_space', 'ignorews') + buildopts['ignorewsamount'] = get('ignore_space_change', + 'ignorewsamount') + buildopts['ignoreblanklines'] = get('ignore_blank_lines', + 'ignoreblanklines') return mdiff.diffopts(**buildopts)