Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 22191:9f9a2b79dcd7
annotate: rewrite long short-circuit statement by if-elif-else
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 15 Aug 2014 14:29:30 +0900 |
parents | 2f0358275501 |
children | d1823cdf8554 |
comparison
equal
deleted
inserted
replaced
22190:55308ab8117c | 22191:9f9a2b79dcd7 |
---|---|
775 | 775 |
776 def with_linenumber(text, rev): | 776 def with_linenumber(text, rev): |
777 size = len(text.splitlines()) | 777 size = len(text.splitlines()) |
778 return ([(rev, i) for i in xrange(1, size + 1)], text) | 778 return ([(rev, i) for i in xrange(1, size + 1)], text) |
779 | 779 |
780 decorate = (((linenumber is None) and decorate_compat) or | 780 if linenumber is None: |
781 (linenumber and with_linenumber) or | 781 decorate = decorate_compat |
782 without_linenumber) | 782 elif linenumber: |
783 decorate = with_linenumber | |
784 else: | |
785 decorate = without_linenumber | |
783 | 786 |
784 def pair(parent, child): | 787 def pair(parent, child): |
785 blocks = mdiff.allblocks(parent[1], child[1], opts=diffopts, | 788 blocks = mdiff.allblocks(parent[1], child[1], opts=diffopts, |
786 refine=True) | 789 refine=True) |
787 for (a1, a2, b1, b2), t in blocks: | 790 for (a1, a2, b1, b2), t in blocks: |