Mercurial > hg-stable
changeset 22192:d1823cdf8554
annotate: inline definition of decorate() functions
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 15 Aug 2014 14:33:19 +0900 |
parents | 9f9a2b79dcd7 |
children | efc591e8b35c |
files | mercurial/context.py |
diffstat | 1 files changed, 7 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/context.py Fri Aug 15 14:29:30 2014 +0900 +++ b/mercurial/context.py Fri Aug 15 14:33:19 2014 +0900 @@ -767,22 +767,16 @@ this returns fixed value(False is used) as linenumber, if "linenumber" parameter is "False".''' - def decorate_compat(text, rev): - return ([rev] * len(text.splitlines()), text) - - def without_linenumber(text, rev): - return ([(rev, False)] * len(text.splitlines()), text) - - def with_linenumber(text, rev): - size = len(text.splitlines()) - return ([(rev, i) for i in xrange(1, size + 1)], text) - if linenumber is None: - decorate = decorate_compat + def decorate(text, rev): + return ([rev] * len(text.splitlines()), text) elif linenumber: - decorate = with_linenumber + def decorate(text, rev): + size = len(text.splitlines()) + return ([(rev, i) for i in xrange(1, size + 1)], text) else: - decorate = without_linenumber + def decorate(text, rev): + return ([(rev, False)] * len(text.splitlines()), text) def pair(parent, child): blocks = mdiff.allblocks(parent[1], child[1], opts=diffopts,