hg site extension
 
(Arne Babenhauserheide)
2011-11-24: Make branches work.

Make branches work.

diff --git a/site.py b/site.py
--- a/site.py
+++ b/site.py
@@ -54,13 +54,13 @@ templates = {
 </head>
 <body>
 """,
-    "foot": "</body></html>",
+    "foot": "</body></html>\n",
     "screenstyle": """ """,
     "printstyle": """ """,
     "manifesthead": """<h2>""" + _("Commit")+""": <a href='../../commit/{hex}.html'>{hex}</a></h2>
 <p>{desc}</p><p>{user}</p>
     <h2>""" + _("Files in this revision") + "</h2>", 
-    "commitlog": """<div style='float: right; padding-left: 0.5em'><em>({author|person})</em></div><strong> {date|shortdate}: <a href='{relativepath}src/{node}/index.html'>{desc|strip|fill68|firstline}</a></strong> <span style='font-size: xx-small'>{branches} {tags} {bookmarks}</span><p>{desc|escape}</p>\n"""
+    "commitlog": """\n<div style='float: right; padding-left: 0.5em'><em>({author|person})</em></div><strong> {date|shortdate}: <a href='{relativepath}src/{node}/index.html'>{desc|strip|fill68|firstline}</a></strong> <span style='font-size: xx-small'>{branches} {tags} {bookmarks}</span><p>{desc|escape}</p>\n"""
 }
 
 _indexregexp = re.compile("^\\.*index.html$")
@@ -124,25 +124,29 @@ def writeoverview(ui, repo, target, name
     overview += ui.popbuffer()
     
     # Add branch, bookmark and tag information, if they exist.
-    branchheads = repo.branchheads()
+    branches = []
+    for branch, heads in repo.branchmap().items(): 
+        if branch and branch != "default": # not default
+            branches.extend(heads)
+
     tags = repo._tags
     bookmarks = repo._bookmarks
-    if branchheads[1:]: # add branches
-        overview += "<h2>Branches</h2>"
-        overview += overviewlogstring(ui, repo, branchheads,
+    if branches: # add branches
+        overview += "\n<h2>Branches</h2>\n"
+        overview += overviewlogstring(ui, repo, branches,
                                       template=templates["commitlog"].replace(
                 "{branches}", "XXXXX").replace(
                 "{date|shortdate}", "{branches}").replace(
                 "XXXXX", "{date|shortdate}"))
     if len(tags) > 1: 
-        overview += "<h2>Tags</h2>"
+        overview += "\n<h2>Tags</h2>\n"
         overview += overviewlogstring(ui, repo, [tags[t] for t in tags if t != "tip"],
                                       template=templates["commitlog"].replace(
                 "{tags}", "XXXXX").replace(
                 "{date|shortdate}", "{tags}").replace(
                 "XXXXX", "{date|shortdate}"))
     if len(bookmarks): 
-        overview += "<h2>Bookmarks</h2>"
+        overview += "\n<h2>Bookmarks</h2>\n"
         overview += overviewlogstring(ui, repo, bookmarks.values(),
                                       template=templates["commitlog"].replace(
                 "{bookmarks}", "XXXXX").replace(