changeset 23430:3821be85fd4d

patch: add a new function to initialize diffopts by feature Not all callers are interested in all diffopts -- for example, commands like record (which use diff internally) break when diffopts like noprefix are enabled. This function will allow us to add flags that callers can use to enable only the features they're interested in.
author Siddharth Agarwal <sid0@fb.com>
date Tue, 18 Nov 2014 16:53:22 -0800
parents f35526b999f4
children 10223d2278f4
files mercurial/patch.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Tue Nov 18 16:00:54 2014 -0800
+++ b/mercurial/patch.py	Tue Nov 18 16:53:22 2014 -0800
@@ -1559,6 +1559,11 @@
     pass
 
 def diffopts(ui, opts=None, untrusted=False, section='diff'):
+    '''return diffopts with all features supported and parsed'''
+    return difffeatureopts(ui, opts=opts, untrusted=untrusted, section=section)
+
+def difffeatureopts(ui, opts=None, untrusted=False, section='diff'):
+    '''return diffopts with only opted-in features parsed'''
     def get(key, name=None, getter=ui.configbool, forceplain=None):
         if opts:
             v = opts.get(key)