changeset 23295:ac072c79bd9d

patch.diffopts: break get function into if statements We're going to add another condition here, and with the current structure that becomes just too confusing.
author Siddharth Agarwal <sid0@fb.com>
date Wed, 12 Nov 2014 23:44:17 -0800
parents ec8c73b02e2e
children 922fcfb02e77
files mercurial/patch.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Wed Nov 12 23:25:32 2014 -0800
+++ b/mercurial/patch.py	Wed Nov 12 23:44:17 2014 -0800
@@ -1559,9 +1559,13 @@
     pass
 
 def diffopts(ui, opts=None, untrusted=False, section='diff'):
-    def get(key, name=None, getter=ui.configbool):
-        return ((opts and opts.get(key)) or
-                getter(section, name or key, None, untrusted=untrusted))
+    def get(key, name=None, getter=ui.configbool, forceplain=None):
+        if opts:
+            v = opts.get(key)
+            if v:
+                return v
+        return getter(section, name or key, None, untrusted=untrusted)
+
     return mdiff.diffopts(
         text=opts and opts.get('text'),
         git=get('git'),