mercurial/templatefilters.py
changeset 15155 f4a8d754cd0a
parent 14967 376091a4ad23
child 16235 eb39bbda167b
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,