mercurial/templatefilters.py
changeset 49021 51aed118f9dc
parent 49020 1138674ecdb8
child 49284 d44e3c45f0e4
--- a/mercurial/templatefilters.py	Thu Mar 24 15:41:29 2022 -0700
+++ b/mercurial/templatefilters.py	Thu Mar 24 16:09:12 2022 -0700
@@ -268,10 +268,7 @@
 @templatefilter(b'firstline', intype=bytes)
 def firstline(text):
     """Any text. Returns the first line of text."""
-    try:
-        return text.splitlines()[0]
-    except IndexError:
-        return b''
+    return stringutil.firstline(text)
 
 
 @templatefilter(b'hex', intype=bytes)