I was trying to create a custom .html style for glog and I could not get the header and footer tags to take (listed in /templates/template-vars.txt). I noticed that the .xml style that comes with hg uses the header and footer tags, and the text is not output. Run hg glog --style xml and compare with what is programed in /templtes/map-cmdline.xml.
Can you be more specific - and perhaps provide a test case that shows the problem and can be included in tests/test-glog.t (in default branch)? It works fine with --style=compact and --style=changelog. It is not clear to me how an xml output with semantic markup could work together with the graphical rendering of graphlog. I think that it is possible that graphlog templating can be extended to cover your usecase if you can provide a good example of what you want and why.
The default and compact styles that come with mercurial do not use the global header and footer tags (defined in /templates/template-vars.txt). The xml and changelog styles that come with mercurial use the global header tag and the xml style is the only one that uses the footer tag. The bug is easy to replicate for the xml and changelog styles on any repository. Execute: hg glog --style xml Here is example output from running the above command: @ <logentry revision="0" node="1aa29fc031c7103673fb5d29e18e1e212398cb0a"> <tag>tip</tag> <author email="bayes.law@gmail.com">babert745</author> <date>2010-09-24T19:58:09-04:00</date> <msg xml:space="preserve">Test</msg> </logentry> My understanding based on reading /templates/template-vars.txt and /templates/map-cmdline.xml is that the output should be: <?xml version="1.0"?> <log> @ <logentry revision="0" node="1aa29fc031c7103673fb5d29e18e1e212398cb0a"> <tag>tip</tag> <author email="bayes.law@gmail.com">babert745</author> <date>2010-09-24T19:58:09-04:00</date> <msg xml:space="preserve">Test</msg> </logentry> </log> The difference is that the actual output is missing the header and footer defined in /templates/map-cmdline.xml as header = '<?xml version="1.0"?>\n<log>\n' footer = '</log>\n' Let me know if this is not specific enough. I am sure the template option is a more powerful feature. But simplicity is powerful too, all I need to do is wrap the glog with a simple html header and footer. I don't know how to add a test case in the tests/test-glog.t, but I will try and look into it.
Ok, so you _just_ want header and footer around the glog output - probably in order to wrap it in pre tags? Can you verify if that is achieved by this patch: --- a/hgext/graphlog.py +++ b/hgext/graphlog.py @@ -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) # write header ascii(ui, state, type, char, lines, edgefn(seen, rev, parents)) + displayer.close() # write footer def graphlog(ui, repo, path=None, **opts): """show revision history alongside an ASCII revision graph
Yep, I want to wrap the output in pre tags and add a java script call. I tested the patch and it works great. hg glog --style xml now includes the header and footer specified in /templates/map-cmdline.xml. Not sure where to go from here, will you push the patch to the production code repository for inclusion in the next release or is there a more formal process?
Do the patch also solve your _real_ problem? (glog with style xml obviously doesn't make any sense at all.)
Sure did. Thanks a bunch.
Fixed by http://hg.intevation.org/mercurial/crew/rev/aa1faedeac5a Mads Kiilerich <mads@kiilerich.com> graphlog: style with header and footer (issue2395)
--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:12 EDT --- This bug was previously known as _bug_ 2395 at http://mercurial.selenic.com/bts/issue2395