# HG changeset patch # User Siddharth Agarwal # Date 2014-11-19 01:10:14 # Node ID 27af986a332bb1c01d16ad8a71e0072532f4bf78 # Parent 10223d2278f4902f465d1c3a56b8c3d6b1055512 patch.difffeatureopts: add a feature for diff.git This deserves to be its own feature -- indeed, this is often the only feature several commands care about. diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -1564,8 +1564,12 @@ def diffallopts(ui, opts=None, untrusted diffopts = diffallopts -def difffeatureopts(ui, opts=None, untrusted=False, section='diff'): - '''return diffopts with only opted-in features parsed''' +def difffeatureopts(ui, opts=None, untrusted=False, section='diff', git=False): + '''return diffopts with only opted-in features parsed + + Features: + - git: git-style diffs + ''' def get(key, name=None, getter=ui.configbool, forceplain=None): if opts: v = opts.get(key) @@ -1577,7 +1581,6 @@ def difffeatureopts(ui, opts=None, untru buildopts = { 'text': opts and opts.get('text'), - 'git': get('git'), 'nodates': get('nodates'), 'nobinary': get('nobinary'), 'noprefix': get('noprefix', forceplain=False), @@ -1588,6 +1591,9 @@ def difffeatureopts(ui, opts=None, untru 'context': get('unified', getter=ui.config), } + if git: + buildopts['git'] = get('git') + return mdiff.diffopts(**buildopts) def diff(repo, node1=None, node2=None, match=None, changes=None, opts=None,