mercurial/templatefilters.py
changeset 43695 fa246ada356b
parent 43333 91c746a77fa3
child 44590 e3e44e6e7245
--- a/mercurial/templatefilters.py	Fri Nov 15 10:16:22 2019 -0800
+++ b/mercurial/templatefilters.py	Fri Nov 15 10:16:27 2019 -0800
@@ -299,7 +299,7 @@
     return dateutil.datestr(text, b'%Y-%m-%d %H:%M:%S %1%2')
 
 
-def indent(text, prefix):
+def indent(text, prefix, firstline=b''):
     '''indent each non-empty line of text after first with prefix.'''
     lines = text.splitlines()
     num_lines = len(lines)
@@ -308,8 +308,8 @@
     def indenter():
         for i in pycompat.xrange(num_lines):
             l = lines[i]
-            if i and l.strip():
-                yield prefix
+            if l.strip():
+                yield prefix if i else firstline
             yield l
             if i < num_lines - 1 or endswithnewline:
                 yield b'\n'