hg site extension
 
(Arne Babenhauserheide)
2011-10-07: no longer abuse commands.log for templating.

no longer abuse commands.log for templating.

diff --git a/static.py b/static.py
--- a/static.py
+++ b/static.py
@@ -36,7 +36,7 @@ import os
 from os.path import join, isdir, isfile, basename
 import shutil
 import mercurial
-import mercurial.cmdutil
+from mercurial import cmdutil
 from mercurial import commands
 
 _staticidentifier = ".statichgrepo"
@@ -110,13 +110,17 @@ def parsesite(ui, repo, target, **opts):
             break
     # now add the 5 most recent log entries
     # divert all following ui output to a string, so we can just use standard functions
+    overview.write("<h2>Changes</h2>")
     ui.pushbuffer()
-    commands.log(ui, repo, template="""<div style='float: right; padding-left: 0.5em'><em>({author|person})</em></div>
-
-<p><strong> {date|shortdate}: <a href='commits/{node}.html'>{desc|strip|fill68|firstline}</a> <span style='font-size: xx-small'>{branches} {tags}</span></p><p>{desc|escape}</p>""", date="", rev="0", user=ui.username())
+    t = cmdutil.changeset_templater(ui, repo, False, None, None, False)
+    t.use_template("""<div style='float: right; padding-left: 0.5em'><em>({author|person})</em></div><strong> {date|shortdate}: <a href='commits/{node}.html'>{desc|strip|fill68|firstline}</a> <span style='font-size: xx-small'>{branches} {tags}</span><p>{desc|escape}</p>""")
+    for c in range(1, max(len(repo.changelog), 5)):
+        ctx = repo.changectx(str(-c))
+        t.show(ctx)
     overview.write(ui.popbuffer())
 
     # add the full readme
+    overview.write("<h2>Readme</h2>")
     overview.write(readme)
 
     # finish the overview