Mercurial > public > mercurial-scm > hg
comparison mercurial/templatefilters.py @ 15155:f4a8d754cd0a
templates: add 'bisect' keyword to return a cset's bisect status
This new 'bisect' template expands to a cset's bisection status (good,
bad and so on...). There is also a new 'shortbisect' filter that yields
a single char representing the cset's bisection status.
It uses the two recently-added hbisect.label() and .shortlabel() functions.
Example output using the repository in test-bisect2.t, and some made-up
state of the 'end at merge' test (with graphlog, it's so explicit):
$ hg glog --template '{rev}:{node|short} {bisect}\n' \
-r 'bisect(range)|bisect(ignored)'
o 17:228c06deef46: bad
|
o 16:609d82a7ebae: bad (implicit)
|
o 15:857b178a7cf3: bad
|\
| o 13:b0a32c86eb31: good
| |
| o 12:9f259202bbe7: good (implicit)
| |
| o 11:82ca6f06eccd: good
| |
@ | 10:429fcd26f52d: untested
|\ \
| o | 9:3c77083deb4a: skipped
| |/
| o 8:dab8161ac8fc: good
| |
o | 6:a214d5d3811a: ignored
|\ \
| o | 5:385a529b6670: ignored
| | |
o | | 4:5c668c22234f: ignored
| | |
o | | 3:0950834f0a9c: ignored
|/ /
o / 2:051e12f87bf1: ignored
|/
And now the same with the short label:
$ hg log --template '{bisect|shortbisect} {rev}:{node|short}\n'
18:d42e18c7bc9b
B 17:228c06deef46
B 16:609d82a7ebae
B 15:857b178a7cf3
14:faa450606157
G 13:b0a32c86eb31
G 12:9f259202bbe7
G 11:82ca6f06eccd
U 10:429fcd26f52d
S 9:3c77083deb4a
G 8:dab8161ac8fc
7:50c76098bbf2
I 6:a214d5d3811a
I 5:385a529b6670
I 4:5c668c22234f
I 3:0950834f0a9c
I 2:051e12f87bf1
1:4ca5088da217
0:33b1f9bc8bc5
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
author | "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> |
---|---|
date | Thu, 22 Sep 2011 01:36:01 +0200 |
parents | 376091a4ad23 |
children | eb39bbda167b |
comparison
equal
deleted
inserted
replaced
15154:aa2e908c521e | 15155:f4a8d754cd0a |
---|---|
5 # This software may be used and distributed according to the terms of the | 5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | 7 |
8 import cgi, re, os, time, urllib | 8 import cgi, re, os, time, urllib |
9 import encoding, node, util | 9 import encoding, node, util |
10 import hbisect | |
10 | 11 |
11 def addbreaks(text): | 12 def addbreaks(text): |
12 """:addbreaks: Any text. Add an XHTML "<br />" tag before the end of | 13 """:addbreaks: Any text. Add an XHTML "<br />" tag before the end of |
13 every line except the last. | 14 every line except the last. |
14 """ | 15 """ |
265 def short(text): | 266 def short(text): |
266 """:short: Changeset hash. Returns the short form of a changeset hash, | 267 """:short: Changeset hash. Returns the short form of a changeset hash, |
267 i.e. a 12 hexadecimal digit string. | 268 i.e. a 12 hexadecimal digit string. |
268 """ | 269 """ |
269 return text[:12] | 270 return text[:12] |
271 | |
272 def shortbisect(text): | |
273 """:shortbisect: Any text. Treats `text` as a bisection status, and | |
274 returns a single-character representing the status (G: good, B: bad, | |
275 S: skipped, U: untested, I: ignored). Returns single space if `text` | |
276 is not a valid bisection status. | |
277 """ | |
278 return hbisect.shortlabel(text) or ' ' | |
270 | 279 |
271 def shortdate(text): | 280 def shortdate(text): |
272 """:shortdate: Date. Returns a date like "2006-09-18".""" | 281 """:shortdate: Date. Returns a date like "2006-09-18".""" |
273 return util.shortdate(text) | 282 return util.shortdate(text) |
274 | 283 |
345 "permissions": permissions, | 354 "permissions": permissions, |
346 "person": person, | 355 "person": person, |
347 "rfc3339date": rfc3339date, | 356 "rfc3339date": rfc3339date, |
348 "rfc822date": rfc822date, | 357 "rfc822date": rfc822date, |
349 "short": short, | 358 "short": short, |
359 "shortbisect": shortbisect, | |
350 "shortdate": shortdate, | 360 "shortdate": shortdate, |
351 "stringescape": stringescape, | 361 "stringescape": stringescape, |
352 "stringify": stringify, | 362 "stringify": stringify, |
353 "strip": strip, | 363 "strip": strip, |
354 "stripdir": stripdir, | 364 "stripdir": stripdir, |