(Arne Babenhauserheide)
2013-05-03: added tons of debug output trying to fix a bug which proved to be added tons of debug output trying to fix a bug which proved to be caused by corruption of my local repo (likely disk-errors…).
diff --git a/staticsite.py b/staticsite.py
--- a/staticsite.py
+++ b/staticsite.py
@@ -202,6 +202,7 @@ def overviewlogstring(ui, repo, revs, te
def writeoverview(ui, repo, target, name):
"""Create the overview page"""
+ ui.debug("[staticsite] writeoverview: header\n")
overview = ""
# get the title
overview += templates["head"].replace("{reponame}", name).replace("{title}", name)
@@ -227,20 +228,26 @@ def writeoverview(ui, repo, target, name
else:
overview += " <span class=\"bugnumber openbugnumberzero\">0</span>"
overview += "<span class=\"bugnumber resolvedbugnumber\"><a href=\"bugs#resolved\">" + str(len(resolvedbugs)) + "√</a></span>)</span>"
-
+
# and the forks
+ ui.debug("[staticsite] writeoverview: header: forks\n")
forks = getforkinfo(ui, target)
if forks:
overview += " | " + _("forks: ")
for forkname, forkuri in forks.items():
+ ui.debug("[staticsite] writeoverview: fork: " + forkname + ": " + forkuri + "\n")
+ ui.debug("[staticsite] writeoverview: forks: getforkdir\n")
overview += "<a href='" + getforkdir(target, forkname) + "'>" + forkname + "</a> "
+ ui.debug("[staticsite] writeoverview: forks: getincoming\n")
incoming, fn, localother = getincoming(ui, repo, otheruri=forkuri, othername=forkname)
overview += "<small>(" + str(len(incoming))
+ ui.debug("[staticsite] writeoverview: forks: getoutgoing\n")
outgoing, fn, localother = getoutgoing(ui, repo, otheruri=forkuri, othername=forkname)
overview += "<small>↓↑</small>" + str(len(outgoing)) + ")</small> "
overview += "</p>"
+ ui.debug("[staticsite] writeoverview: shortlog\n")
# now add the 5 most recent log entries
# divert all following ui output to a string, so we can just use standard functions
overview += "\n<div id='shortlog'><h2>Changes (<a href='commits'>full changelog</a>)</h2>\n"
@@ -254,6 +261,7 @@ def writeoverview(ui, repo, target, name
overview += "</div>"
# Add branch, bookmark and tag information, if they exist.
+ ui.debug("[staticsite] writeoverview: branches, tags and bookmarks\n")
branches = []
for branch, heads in repo.branchmap().items():
if branch and branch != "default": # not default
@@ -302,11 +310,13 @@ def writeoverview(ui, repo, target, name
"XXXXX", "{date|shortdate}"))
overview += "</div>"
# add the full readme
+ ui.debug("[staticsite] writeoverview: readme\n")
overview += "<div id='readme'><h2>"+_("Readme")+"</h2>\n"
overview += readme
overview += "</div>"
# finish the overview
+ ui.debug("[staticsite] writeoverview: footer\n")
overview += templates["foot"]
indexfile = os.path.join(target, "index.html")
if not contentequals(indexfile, overview):
@@ -423,6 +433,7 @@ def getoutgoing(ui, repo, otheruri, othe
pass
# cannot do that for ftp or freenet insertion uris (freenet
# separates insertion and retrieval by private/public key)
+ ui.debug("[staticsite] getoutgoing: checkkeys\n")
isftpuri = otheruri.startswith("ftp://")
isfreenetpriv = "AQECAAE/" in otheruri
if isftpuri or isfreenetpriv:
@@ -430,30 +441,45 @@ def getoutgoing(ui, repo, otheruri, othe
return chlist, cleanupfn, other
if not other:
+ ui.debug("[staticsite] getoutgoing: findpeer\n")
other = hg.peer(repo, {}, otheruri)
def outgoingchanges(repo, other):
from mercurial import discovery
fco = discovery.findcommonoutgoing
og = fco(repo, other, force=True)
+ # print dir(og), og.missingheads, og.missing
+ ui.debug("[staticsite] getoutgoing: outgoingchanges: og.missing\n")
try:
return og.missing
except AttributeError: # old client
common, outheads = og
o = repo.changelog.findmissing(common=common, heads=outheads)
return o
-
+ except Exception as e:
+ ui.warn("Cannot parse parts of your local history. Likely your local repository is broken. You might be able to fix it by getting a fresh clone and pulling from your current repo. The Error was: " + str(e) + "\n")
+
other.ui.pushbuffer() # ignore ui events
+ ui.debug("[staticsite] getoutgoing: outgoingchanges\n")
try:
chlist = outgoingchanges(repo, other)
except (AttributeError, util.Abort):
other.ui.popbuffer()
+ ui.debug("[staticsite] getoutgoing: local other\n")
other = getlocalother(repo, ui, otheruri, othername)
other.ui.pushbuffer()
- chlist = outgoingchanges(repo, other)
+ ui.debug("[staticsite] getoutgoing: outgoingchanges, local\n")
+ try:
+ chlist = outgoingchanges(repo, other)
+ except Exception as e: # no changes
+ ui.debug("[staticsite] getoutgoing: outgoingchanges, errer: " + str(e) + "\n")
+ raise
+ chlist = []
+ ui.debug("[staticsite] getoutgoing: popbuffer\n")
other.ui.popbuffer()
+ ui.debug("[staticsite] getoutgoing: done\n")
return chlist, cleanupfn, other
def getforkinfo(ui, target):
@@ -782,22 +808,28 @@ def parsesite(ui, repo, target, **opts):
highlightingfile = os.path.join(target, pretty)
if not os.path.isfile(highlightingfile) or not samefilecontent(highlightingsrc, highlightingfile):
shutil.copyfile(highlightingsrc, highlightingfile)
-
+
+ ui.debug("[staticsite] writeoverview\n")
# then the overview
writeoverview(ui, repo, target, name)
+ ui.debug("[staticsite] writelog\n")
# and the log
writelog(ui, repo, target, name)
+ ui.debug("[staticsite] writecommits\n")
# and all commit files
writecommits(ui, repo, target, name, force=opts["force"])
+ ui.debug("[staticsite] writesourcetree\n")
# and all file data
writesourcetree(ui, repo, target, name, force=opts["force"])
+ ui.debug("[staticsite] writeforks\n")
# and all forks
writeforks(ui, repo, target, name)
+ ui.debug("[staticsite] writebugs\n")
# and all bugs
writebugs(ui, repo, target, name)