[PATCH 4 of 7] patch.difffeatureopts: add a feature for diff.git

Siddharth Agarwal sid0 at fb.com
Fri Nov 21 19:00:06 CST 2014


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1416359414 28800
#      Tue Nov 18 17:10:14 2014 -0800
# Node ID 959a08bde79e880c8ce3ed638a5e4f242db6d1a0
# Parent  ec03d9f0198eafe8933924bbeadd2586866eb9f7
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 mercurial/patch.py mercurial/patch.py
--- mercurial/patch.py
+++ mercurial/patch.py
@@ -1559,11 +1559,12 @@
     pass
 
 def diffallopts(ui, opts=None, untrusted=False, section='diff'):
-    return difffeatureopts(ui, opts=opts, untrusted=untrusted, section=section)
+    return difffeatureopts(ui, opts=opts, untrusted=untrusted, section=section,
+                           git=True)
 
 diffopts = diffallopts
 
-def difffeatureopts(ui, opts=None, untrusted=False, section='diff'):
+def difffeatureopts(ui, opts=None, untrusted=False, section='diff', git=False):
     def get(key, name=None, getter=ui.configbool, forceplain=None):
         if opts:
             v = opts.get(key)
@@ -1575,7 +1576,6 @@
 
     buildopts = {
         'text': opts and opts.get('text'),
-        'git': get('git'),
         'nodates': get('nodates'),
         'nobinary': get('nobinary'),
         'noprefix': get('noprefix', forceplain=False),
@@ -1586,6 +1586,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,


More information about the Mercurial-devel mailing list