mercurial/utils/stringutil.py
changeset 49021 51aed118f9dc
parent 48946 642e31cb55f0
child 49030 75794847ef62
equal deleted inserted replaced
49020:1138674ecdb8 49021:51aed118f9dc
   683     False
   683     False
   684     """
   684     """
   685     return _correctauthorformat.match(author) is not None
   685     return _correctauthorformat.match(author) is not None
   686 
   686 
   687 
   687 
       
   688 def firstline(text):
       
   689     """Return the first line of the input"""
       
   690     try:
       
   691         return text.splitlines()[0]
       
   692     except IndexError:
       
   693         return b''
       
   694 
       
   695 
   688 def ellipsis(text, maxlength=400):
   696 def ellipsis(text, maxlength=400):
   689     """Trim string to at most maxlength (default: 400) columns in display."""
   697     """Trim string to at most maxlength (default: 400) columns in display."""
   690     return encoding.trim(text, maxlength, ellipsis=b'...')
   698     return encoding.trim(text, maxlength, ellipsis=b'...')
   691 
   699 
   692 
   700