(Arne Babenhauserheide)
2012-10-30: writes the list of all bugs. write-bug-details-1d631d51ff06b3bdca50e21da3d6a00bcb801c85 writes the list of all bugs.
diff --git a/staticsite.py b/staticsite.py
--- a/staticsite.py
+++ b/staticsite.py
@@ -122,11 +122,11 @@ def splitbugline(line):
description = "".join(line.split("-")[1:]).lstrip()
return bugid, description
-def getbugdetails(ui, bugid):
+def getbugdetails(ui, repo, bugid):
"""Get the details for a bug."""
# first get the details
ui.pushbuffer()
- req = dispatch.request(["b", "details", bugid], ui=ui)
+ req = dispatch.request(["b", "details", bugid], ui=ui, repo=repo)
dispatch.dispatch(req)
return ui.popbuffer()
@@ -141,15 +141,15 @@ def getbugfullid(details, bugid):
class BBug(object):
"""A b-extension bug."""
- def __init__(self, bugid, description, state, details=""):
- self.bugid, self.description, self.state, self.details = bugid, description, state, details
+ def __init__(self, shortid, fullid, description, state, details=""):
+ self.shortid, self.fullid, self.description, self.state, self.details = shortid, fullid, description, state, details
-def getbuginfo(ui, bugline):
+def getbuginfo(ui, repo, bugline):
"""Get information about a bug from its bugline."""
- bugid, description = splitbugline(bugline)
- details = getbugdetails(ui, bugid)
- bugid = getbugfullid(details, bugid)
- return bugid, description, details
+ shortid, description = splitbugline(bugline)
+ details = getbugdetails(ui, repo, shortid)
+ fullid = getbugfullid(details, shortid)
+ return shortid, fullid, description, details
def getbugs(ui, repo):
"""Get all bugs."""
@@ -168,12 +168,12 @@ def getbugs(ui, repo):
# now turn them into a list of bugs
openbugs = []
for bugline in openbuglines:
- bugid, description, details = getbuginfo(ui, bugline)
- openbugs.append(BBug(bugid, description, "open", details))
+ bugid, fullid, description, details = getbuginfo(ui, repo, bugline)
+ openbugs.append(BBug(bugid, fullid, description, "open", details))
resolvedbugs = []
for bugline in resolvedbuglines:
- bugid, description, details = getbuginfo(ui, bugline)
- resolvedbugs.append(BBug(bugid, description, "resolved", details))
+ bugid, fullid, description, details = getbuginfo(ui, repo, bugline)
+ resolvedbugs.append(BBug(bugid, fullid, description, "resolved", details))
return openbugs, resolvedbugs
def parsereadme(filepath, truncated=False):
@@ -553,12 +553,25 @@ def writecommits(ui, repo, target, name,
def writebugs(ui, repo, target, name):
"""Write bug information, a listing and the details for each bug."""
- bugdir = os.path.join(target, "commit")
+ bugdir = os.path.join(target, "bugs")
- # create the folders
+ # create the bugs folder
if not os.path.isdir(bugdir):
os.makedirs(bugdir)
+ # get all bugs
+ openbugs, resolvedbugs = getbugs(ui, repo)
+ # write the bugs file
+ bugslist = os.path.join(bugdir, "index.html")
+ content = "<h2>Open Bugs</h2>\n<ul>"
+ for bug in openbugs:
+ content += "<li><a href=\"" + bug.fullid + ".html\">" + bug.shortid + "</a> - " + bug.description + "</li>\n"
+ with open(bugslist, "w") as f:
+ f.write(templates["head"].replace("{reponame}", "<a href='../'>"+name+"</a>").replace("{title}", name))
+ f.write(content)
+ f.write(templates["foot"].replace("{reponame}", "<a href='../'>"+name+"</a>"))
+
+
def escapename(filename):
"""escape index.html as .index.html and .ind… as ..ind… and so fort."""
@@ -713,6 +726,9 @@ def parsesite(ui, repo, target, **opts):
# and all forks
writeforks(ui, repo, target, name)
+
+ # and all bugs
+ writebugs(ui, repo, target, name)
def addrepo(ui, repo, target, bookmarks, force):
"""Add the repo to the target and make sure it is up to date."""