[PATCH 4 of 6] add untrusted argument to patch.diffopts

Alexis S. L. Carvalho alexis at cecm.usp.br
Tue Oct 17 23:52:18 CDT 2006


# HG changeset patch
# User Alexis S. L. Carvalho <alexis at cecm.usp.br>
# Date 1161149395 10800
# Node ID cffdbf687f6c992b8d7c9481642214d96d2a9ca8
# Parent  0b41d5cd119825141b67f57efb3f20d56362e368
add untrusted argument to patch.diffopts

diff -r 0b41d5cd1198 -r cffdbf687f6c mercurial/patch.py
--- a/mercurial/patch.py	Wed Oct 18 02:29:55 2006 -0300
+++ b/mercurial/patch.py	Wed Oct 18 02:29:55 2006 -0300
@@ -328,21 +328,18 @@ def patch(patchname, ui, strip=1, cwd=No
 
     return (files, fuzz)
 
-def diffopts(ui, opts={}):
+def diffopts(ui, opts={}, untrusted=False):
+    def get(key, name=None):
+        return (opts.get(key) or
+                ui.configbool('diff', name or key, None, untrusted=untrusted))
     return mdiff.diffopts(
         text=opts.get('text'),
-        git=(opts.get('git') or
-                  ui.configbool('diff', 'git', None)),
-        nodates=(opts.get('nodates') or
-                  ui.configbool('diff', 'nodates', None)),
-        showfunc=(opts.get('show_function') or
-                  ui.configbool('diff', 'showfunc', None)),
-        ignorews=(opts.get('ignore_all_space') or
-                  ui.configbool('diff', 'ignorews', None)),
-        ignorewsamount=(opts.get('ignore_space_change') or
-                        ui.configbool('diff', 'ignorewsamount', None)),
-        ignoreblanklines=(opts.get('ignore_blank_lines') or
-                          ui.configbool('diff', 'ignoreblanklines', None)))
+        git=get('git'),
+        nodates=get('nodates'),
+        showfunc=get('show_function', 'showfunc'),
+        ignorews=get('ignore_all_space', 'ignorews'),
+        ignorewsamount=get('ignore_space_change', 'ignorewsamount'),
+        ignoreblanklines=get('ignore_blank_lines', 'ignoreblanklines'))
 
 def updatedir(ui, repo, patches, wlock=None):
     '''Update dirstate after patch application according to metadata'''


More information about the Mercurial-devel mailing list