[PATCH 6 of 7] patch.difffeatureopts: add a feature for format-changing diffopts
Siddharth Agarwal
sid0 at fb.com
Sat Nov 22 01:00:08 UTC 2014
# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1416360123 28800
# Tue Nov 18 17:22:03 2014 -0800
# Node ID 6aa17cf4615cef0e44c99d73864db1aa244ea580
# Parent ad1f8562f7be97be977b013071ce0bdb1541649c
patch.difffeatureopts: add a feature for format-changing diffopts
Typically, callers that are interested in this set are also interested in the
others. We still add it as a first-class flag for convenience.
diff --git mercurial/patch.py mercurial/patch.py
--- mercurial/patch.py
+++ mercurial/patch.py
@@ -1560,12 +1560,12 @@
def diffallopts(ui, opts=None, untrusted=False, section='diff'):
return difffeatureopts(ui, opts=opts, untrusted=untrusted, section=section,
- git=True, whitespace=True)
+ git=True, whitespace=True, formatchanging=True)
diffopts = diffallopts
def difffeatureopts(ui, opts=None, untrusted=False, section='diff', git=False,
- whitespace=False):
+ whitespace=False, formatchanging=False):
def get(key, name=None, getter=ui.configbool, forceplain=None):
if opts:
v = opts.get(key)
@@ -1575,11 +1575,9 @@
return forceplain
return getter(section, name or key, None, untrusted=untrusted)
+ # core options, expected to be understood by every diff parser
buildopts = {
- 'text': opts and opts.get('text'),
'nodates': get('nodates'),
- 'nobinary': get('nobinary'),
- 'noprefix': get('noprefix', forceplain=False),
'showfunc': get('show_function', 'showfunc'),
'context': get('unified', getter=ui.config),
}
@@ -1592,6 +1590,10 @@
'ignorewsamount')
buildopts['ignoreblanklines'] = get('ignore_blank_lines',
'ignoreblanklines')
+ if formatchanging:
+ buildopts['text'] = opts and opts.get('text')
+ buildopts['nobinary'] = get('nobinary')
+ buildopts['noprefix'] = get('noprefix', forceplain=False)
return mdiff.diffopts(**buildopts)
More information about the Mercurial-devel
mailing list