annotate: rewrite long short-circuit statement by if-elif-else
authorYuya Nishihara <yuya@tcha.org>
Fri, 15 Aug 2014 14:29:30 +0900
changeset 22191 9f9a2b79dcd7
parent 22190 55308ab8117c
child 22192 d1823cdf8554
annotate: rewrite long short-circuit statement by if-elif-else
mercurial/context.py
--- a/mercurial/context.py	Tue Jun 24 17:27:18 2014 +0100
+++ b/mercurial/context.py	Fri Aug 15 14:29:30 2014 +0900
@@ -777,9 +777,12 @@
             size = len(text.splitlines())
             return ([(rev, i) for i in xrange(1, size + 1)], text)
 
-        decorate = (((linenumber is None) and decorate_compat) or
-                    (linenumber and with_linenumber) or
-                    without_linenumber)
+        if linenumber is None:
+            decorate = decorate_compat
+        elif linenumber:
+            decorate = with_linenumber
+        else:
+            decorate = without_linenumber
 
         def pair(parent, child):
             blocks = mdiff.allblocks(parent[1], child[1], opts=diffopts,