(Arne Babenhauserheide)
2011-11-24: Add a list of branches, heads and tags to the summary page. Add a list of branches, heads and tags to the summary page.
diff --git a/.bugs/details/0fde104c4206be8245ff0716ee2e91ea3971db8f.txt b/.bugs/details/0fde104c4206be8245ff0716ee2e91ea3971db8f.txt
new file mode 100644
--- /dev/null
+++ b/.bugs/details/0fde104c4206be8245ff0716ee2e91ea3971db8f.txt
@@ -0,0 +1,43 @@
+# Lines starting with u'#' and sections without content
+# are not displayed by a call to u'details'
+#
+[paths]
+# Paths related to this bug.
+# suggested format: REPO_PATH:LINENUMBERS
+
+
+[details]
+# Additional details
+What I want:
+
+Branches
+--------
+
+(list of commits)
+
+Bookmarks
+---------
+
+(list of bookmarks
+
+Tags
+----
+
+(list of tags)
+
+Goes on the overview site.
+
+[expected]
+# The expected result
+
+
+[actual]
+# What happened instead
+
+
+[reproduce]
+# Reproduction steps
+
+
+[comments]
+# Comments and updates - leave your name
diff --git a/site.py b/site.py
--- a/site.py
+++ b/site.py
@@ -87,6 +87,17 @@ def parsereadme(filepath):
return "<pre>" + r.read() + "</pre>"
+def overviewlogstring(ui, repo, revs, template=templates["commitlog"]):
+ """Get the string for a log of the given revisions for the overview page."""
+ ui.pushbuffer()
+ t = cmdutil.changeset_templater(ui, repo, patch=False, diffopts=None, mapfile=None, buffered=False)
+ t.use_template(template.replace("{relativepath}", ""))
+ for c in revs:
+ ctx = repo.changectx(c)
+ t.show(ctx)
+ return ui.popbuffer()
+
+
def writeoverview(ui, repo, target, name):
"""Create the overview page"""
overview = ""
@@ -111,6 +122,32 @@ def writeoverview(ui, repo, target, name
ctx = repo.changectx(str(-c))
t.show(ctx)
overview += ui.popbuffer()
+
+ # Add branch, bookmark and tag information, if they exist.
+ branchheads = repo.branchheads()
+ tags = repo._tags
+ bookmarks = repo._bookmarks
+ if branchheads[1:]: # add branches
+ overview += "<h2>Branches</h2>"
+ overview += overviewlogstring(ui, repo, branchheads,
+ template=templates["commitlog"].replace(
+ "{branches}", "XXXXX").replace(
+ "{date|shortdate}", "{branches}").replace(
+ "XXXXX", "{date|shortdate}"))
+ if len(tags) > 1:
+ overview += "<h2>Tags</h2>"
+ 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 += overviewlogstring(ui, repo, bookmarks.values(),
+ template=templates["commitlog"].replace(
+ "{bookmarks}", "XXXXX").replace(
+ "{date|shortdate}", "{bookmarks}").replace(
+ "XXXXX", "{date|shortdate}"))
# add the full readme
overview += "<h2>"+_("Readme")+"</h2>\n"