[PATCH 1 of 7] patch.diffopts: use a dict for initialization

Siddharth Agarwal sid0 at fb.com
Sat Nov 22 01:00:03 UTC 2014


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1416355254 28800
#      Tue Nov 18 16:00:54 2014 -0800
# Node ID cefd057e041cf287634002945472a0501900c66e
# Parent  a179db3db9b96b38c10c491e6e7e7ad5f40a7787
patch.diffopts: use a dict for initialization

In upcoming patches we'll conditionally add to and remove from the dict.

diff --git mercurial/patch.py mercurial/patch.py
--- mercurial/patch.py
+++ mercurial/patch.py
@@ -1568,17 +1568,20 @@
             return forceplain
         return getter(section, name or key, None, untrusted=untrusted)
 
-    return mdiff.diffopts(
-        text=opts and opts.get('text'),
-        git=get('git'),
-        nodates=get('nodates'),
-        nobinary=get('nobinary'),
-        noprefix=get('noprefix', forceplain=False),
-        showfunc=get('show_function', 'showfunc'),
-        ignorews=get('ignore_all_space', 'ignorews'),
-        ignorewsamount=get('ignore_space_change', 'ignorewsamount'),
-        ignoreblanklines=get('ignore_blank_lines', 'ignoreblanklines'),
-        context=get('unified', getter=ui.config))
+    buildopts = {
+        'text': opts and opts.get('text'),
+        'git': get('git'),
+        'nodates': get('nodates'),
+        'nobinary': get('nobinary'),
+        'noprefix': get('noprefix', forceplain=False),
+        'showfunc': get('show_function', 'showfunc'),
+        'ignorews': get('ignore_all_space', 'ignorews'),
+        'ignorewsamount': get('ignore_space_change', 'ignorewsamount'),
+        'ignoreblanklines': get('ignore_blank_lines', 'ignoreblanklines'),
+        'context': get('unified', getter=ui.config),
+    }
+
+    return mdiff.diffopts(**buildopts)
 
 def diff(repo, node1=None, node2=None, match=None, changes=None, opts=None,
          losedatafn=None, prefix=''):


More information about the Mercurial-devel mailing list