hg site extension
 
(Arne Babenhauserheide)
2012-08-11: also show all outgoing changesets for all repo types except FTP. getincomingfromany

also show all outgoing changesets for all repo types except FTP.

diff --git a/staticsite.py b/staticsite.py
--- a/staticsite.py
+++ b/staticsite.py
@@ -141,7 +141,7 @@ def writeoverview(ui, repo, target, name
             overview += "<a href='" + getforkdir(target, forkname) + "'>" + forkname + "</a> "
             incoming, fn, localother = getincoming(ui, repo, otheruri=forkuri, othername=forkname)
             overview += "<small>(" + str(len(incoming))
-            outgoing, fn = getoutgoing(ui, repo, forkuri)
+            outgoing, fn, localother = getoutgoing(ui, repo, otheruri=forkuri, othername=forkname)
             overview += "<small>↓↑</small>" + str(len(outgoing)) + ")</small> "
 
     overview += "</p>"
@@ -284,7 +284,7 @@ def getlocalother(repo, ui, otheruri, ot
 
 def getincoming(ui, repo, otheruri, other=None, othername=None):
     # cannot do that for ftp repos, yet
-    if otheruri.startswith("ftp://"):# or otheruri.startswith("freenet://"):
+    if otheruri.startswith("ftp://"):
         chlist = []
         def cleanupfn():
             pass
@@ -308,28 +308,33 @@ def getincoming(ui, repo, otheruri, othe
     ui.popbuffer()
     return chlist, cleanupfn, other
 
-def getoutgoing(ui, repo, otheruri, other=None):
+def getoutgoing(ui, repo, otheruri, other=None, othername=None):
     # cannot do that for ftp repos, yet
-    if otheruri.startswith("ftp://") or otheruri.startswith("freenet://"):
+    if otheruri.startswith("ftp://"):
         chlist = []
         def cleanupfn():
             pass
-        return chlist, cleanupfn
+        return chlist, cleanupfn, other
+
     if not other: 
         other = hg.peer(repo, {}, otheruri)
     other.ui.pushbuffer() # ignore ui events
     source, branches = hg.parseurl(repo.root, None)
-    revs, checkout = hg.addbranchrevs(other, repo, branches, None)
-    if revs:
-        revs = [repo.lookup(rev) for rev in revs]
     try: # FIXME: This breaks on http repos! 
+        revs, checkout = hg.addbranchrevs(other, repo, branches, None)
+        if revs:
+            revs = [repo.lookup(rev) for rev in revs]
         other, chlist, cleanupfn = hg.bundlerepo.getremotechanges(ui, other, repo,
                                                                revs, False, False)
-    except AttributeError:
-        chlist = []
-        def cleanupfn():
-            pass
-    return chlist, cleanupfn
+    except (AttributeError, util.Abort):
+        other.ui.popbuffer()
+        other = getlocalother(repo, ui, otheruri, othername)
+        revs, checkout = hg.addbranchrevs(other, repo, branches, None)
+        if revs:
+            revs = [repo.lookup(rev) for rev in revs]
+        other, chlist, cleanupfn = hg.bundlerepo.getremotechanges(ui, other, repo,
+                                                               revs, False, False)
+    return chlist, cleanupfn, other
 
 
 def getforkinfo(ui, target):
@@ -372,7 +377,7 @@ def getforkdata(ui, repo, target, name, 
 
     # add outgoing commits
     html += "<div id='outgoing'><h2>Outgoing commits</h2>"
-    chlist, cleanupfn = getoutgoing(ui, repo, forkuri, other=other)
+    chlist, cleanupfn, localother = getoutgoing(ui, repo, forkuri, other=other, othername=forkname)
 
     ui.pushbuffer()
     for ch in chlist: