Patchwork [5,of,7] patch.difffeatureopts: add a feature for whitespace diffopts

login
register
mail settings
Submitter Siddharth Agarwal
Date Nov. 22, 2014, 1 a.m.
Message ID <ad1f8562f7be97be977b.1416618007@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/6826/
State Superseded
Commit 41dd76b3facb27d71e7852ee74e55a6176d6b2ef
Headers show

Comments

Siddharth Agarwal - Nov. 22, 2014, 1 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1416359366 28800
#      Tue Nov 18 17:09:26 2014 -0800
# Node ID ad1f8562f7be97be977b013071ce0bdb1541649c
# Parent  959a08bde79e880c8ce3ed638a5e4f242db6d1a0
patch.difffeatureopts: add a feature for whitespace diffopts

These aren't exactly format-breaking features -- just ones for which patches
applied to a repo will produce incorrect commits, In any case, some commands
like record and annotate only care about this feature.

Patch

diff --git mercurial/patch.py mercurial/patch.py
--- mercurial/patch.py
+++ mercurial/patch.py
@@ -1560,11 +1560,12 @@ 
 
 def diffallopts(ui, opts=None, untrusted=False, section='diff'):
     return difffeatureopts(ui, opts=opts, untrusted=untrusted, section=section,
-                           git=True)
+                           git=True, whitespace=True)
 
 diffopts = diffallopts
 
-def difffeatureopts(ui, opts=None, untrusted=False, section='diff', git=False):
+def difffeatureopts(ui, opts=None, untrusted=False, section='diff', git=False,
+                    whitespace=False):
     def get(key, name=None, getter=ui.configbool, forceplain=None):
         if opts:
             v = opts.get(key)
@@ -1580,14 +1581,17 @@ 
         '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),
     }
 
     if git:
         buildopts['git'] = get('git')
+    if whitespace:
+        buildopts['ignorews'] = get('ignore_all_space', 'ignorews')
+        buildopts['ignorewsamount'] = get('ignore_space_change',
+                                          'ignorewsamount')
+        buildopts['ignoreblanklines'] = get('ignore_blank_lines',
+                                            'ignoreblanklines')
 
     return mdiff.diffopts(**buildopts)