[PATCH 4 of 7] patch.difffeatureopts: add a feature for diff.git
Siddharth Agarwal
sid0 at fb.com
Tue Nov 25 21:53:59 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 96968af29581f3ee6ab47c0fc14b16e8a55f1751
# Parent fd40c9cc3d796042efb79148c1dcbdbaf073da54
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
@@ -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,
More information about the Mercurial-devel
mailing list