mercurial/patch.py
changeset 23432 27af986a332b
parent 23431 10223d2278f4
child 23433 41dd76b3facb
--- a/mercurial/patch.py	Tue Nov 18 21:43:38 2014 -0800
+++ b/mercurial/patch.py	Tue Nov 18 17:10:14 2014 -0800
@@ -1564,8 +1564,12 @@
 
 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 @@
 
     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 @@
         '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,