changeset 12579:aa1faedeac5a

graphlog: style with header and footer (issue2395) The glog command didn't emit header and footer from the style, as demonstrated by "hg glog --style xml". Asciiart combined with xml markup hardly makes sense, but header and footer might however be useful for adding for example html pre tags around the graph.
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 28 Sep 2010 02:58:00 +0200
parents fdb0983ad395
children 0ae639c75b8c
files hgext/graphlog.py tests/test-glog.t
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/graphlog.py	Tue Sep 28 02:57:59 2010 +0200
+++ b/hgext/graphlog.py	Tue Sep 28 02:58:00 2010 +0200
@@ -229,7 +229,9 @@
         char = ctx.node() in showparents and '@' or 'o'
         displayer.show(ctx)
         lines = displayer.hunk.pop(rev).split('\n')[:-1]
+        displayer.flush(rev)
         ascii(ui, state, type, char, lines, edgefn(seen, rev, parents))
+    displayer.close()
 
 def graphlog(ui, repo, path=None, **opts):
     """show revision history alongside an ASCII revision graph
--- a/tests/test-glog.t	Tue Sep 28 02:57:59 2010 +0200
+++ b/tests/test-glog.t	Tue Sep 28 02:58:00 2010 +0200
@@ -740,6 +740,17 @@
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     one
   
+Issue2395: glog --style header and footer
+  $ hg glog --style=xml one
+  <?xml version="1.0"?>
+  <log>
+  o  <logentry revision="0" node="3d578b4a1f537d5fcf7301bfa9c0b97adfaa6fb1">
+     <author email="test">test</author>
+     <date>1970-01-01T00:00:00+00:00</date>
+     <msg xml:space="preserve">one</msg>
+     </logentry>
+  </log>
+
   $ cd ..
 
 Incoming and outgoing: