mercurial/commands.py
changeset 32649 7a209737f01c
parent 32648 d3d262ff42c0
child 32754 723de0ad3d8b
--- a/mercurial/commands.py	Sat Jun 03 00:05:12 2017 +0900
+++ b/mercurial/commands.py	Sat Jun 03 00:25:24 2017 +0900
@@ -377,15 +377,18 @@
 
     for abs in ctx.walk(m):
         fctx = ctx[abs]
+        rootfm.startitem()
+        rootfm.data(abspath=abs, path=m.rel(abs))
         if not opts.get('text') and fctx.isbinary():
             rootfm.plain(_("%s: binary file\n")
                          % ((pats and m.rel(abs)) or abs))
             continue
 
-        fm = rootfm
+        fm = rootfm.nested('lines')
         lines = fctx.annotate(follow=follow, linenumber=linenumber,
                               skiprevs=skiprevs, diffopts=diffopts)
         if not lines:
+            fm.end()
             continue
         formats = []
         pieces = []
@@ -407,6 +410,7 @@
 
         if not lines[-1][1].endswith('\n'):
             fm.plain('\n')
+        fm.end()
 
     rootfm.end()