Mercurial > hg
changeset 36830:71f189941791
templatefilters: inline hbisect.shortlabel()
It's pretty simple. I don't think the business logic has to be placed in
hbisect.py.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 06 Mar 2018 07:15:01 -0600 |
parents | 4eb3bf227ce7 |
children | 82af07e1ae16 |
files | mercurial/hbisect.py mercurial/templatefilters.py |
diffstat | 2 files changed, 5 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hbisect.py Tue Mar 06 07:11:24 2018 -0600 +++ b/mercurial/hbisect.py Tue Mar 06 07:15:01 2018 -0600 @@ -267,12 +267,6 @@ return None -def shortlabel(label): - if label: - return label[0].upper() - - return None - def printresult(ui, repo, state, displayer, nodes, good): if len(nodes) == 1: # narrowed it down to a single revision
--- a/mercurial/templatefilters.py Tue Mar 06 07:11:24 2018 -0600 +++ b/mercurial/templatefilters.py Tue Mar 06 07:15:01 2018 -0600 @@ -14,7 +14,6 @@ from . import ( encoding, error, - hbisect, node, pycompat, registrar, @@ -343,13 +342,15 @@ return text[:12] @templatefilter('shortbisect') -def shortbisect(text): - """Any text. Treats `text` as a bisection status, and +def shortbisect(label): + """Any text. Treats `label` as a bisection status, and returns a single-character representing the status (G: good, B: bad, S: skipped, U: untested, I: ignored). Returns single space if `text` is not a valid bisection status. """ - return hbisect.shortlabel(text) or ' ' + if label: + return label[0].upper() + return ' ' @templatefilter('shortdate') def shortdate(text):