mercurial/templatefilters.py
changeset 36830 71f189941791
parent 36607 c6061cadb400
child 36831 82af07e1ae16
equal deleted inserted replaced
36829:4eb3bf227ce7 36830:71f189941791
    12 import time
    12 import time
    13 
    13 
    14 from . import (
    14 from . import (
    15     encoding,
    15     encoding,
    16     error,
    16     error,
    17     hbisect,
       
    18     node,
    17     node,
    19     pycompat,
    18     pycompat,
    20     registrar,
    19     registrar,
    21     templatekw,
    20     templatekw,
    22     url,
    21     url,
   341     i.e. a 12 hexadecimal digit string.
   340     i.e. a 12 hexadecimal digit string.
   342     """
   341     """
   343     return text[:12]
   342     return text[:12]
   344 
   343 
   345 @templatefilter('shortbisect')
   344 @templatefilter('shortbisect')
   346 def shortbisect(text):
   345 def shortbisect(label):
   347     """Any text. Treats `text` as a bisection status, and
   346     """Any text. Treats `label` as a bisection status, and
   348     returns a single-character representing the status (G: good, B: bad,
   347     returns a single-character representing the status (G: good, B: bad,
   349     S: skipped, U: untested, I: ignored). Returns single space if `text`
   348     S: skipped, U: untested, I: ignored). Returns single space if `text`
   350     is not a valid bisection status.
   349     is not a valid bisection status.
   351     """
   350     """
   352     return hbisect.shortlabel(text) or ' '
   351     if label:
       
   352         return label[0].upper()
       
   353     return ' '
   353 
   354 
   354 @templatefilter('shortdate')
   355 @templatefilter('shortdate')
   355 def shortdate(text):
   356 def shortdate(text):
   356     """Date. Returns a date like "2006-09-18"."""
   357     """Date. Returns a date like "2006-09-18"."""
   357     return dateutil.shortdate(text)
   358     return dateutil.shortdate(text)