hg site extension
 
(Arne Babenhauserheide)
2012-08-11: special case for freenet insert uris to avoid requesting data from

special case for freenet insert uris to avoid requesting data from private keys.

diff --git a/staticsite.py b/staticsite.py
--- a/staticsite.py
+++ b/staticsite.py
@@ -283,8 +283,10 @@ def getlocalother(repo, ui, otheruri, ot
     return other
 
 def getincoming(ui, repo, otheruri, other=None, othername=None):
-    # cannot do that for ftp repos, yet
-    if otheruri.startswith("ftp://"):
+    # cannot do that for ftp or freenet repos
+    isftpuri = otheruri.startswith("ftp://")
+    isfreenetpriv = "AQECAAE/" in otheruri
+    if isftpuri or isfreenetpriv:
         chlist = []
         def cleanupfn():
             pass
@@ -309,8 +311,10 @@ def getincoming(ui, repo, otheruri, othe
     return chlist, cleanupfn, other
 
 def getoutgoing(ui, repo, otheruri, other=None, othername=None):
-    # cannot do that for ftp repos, yet
-    if otheruri.startswith("ftp://"):
+    # cannot do that for ftp or freenet repos
+    isftpuri = otheruri.startswith("ftp://")
+    isfreenetpriv = "AQECAAE/" in otheruri
+    if isftpuri or isfreenetpriv:
         chlist = []
         def cleanupfn():
             pass
@@ -320,7 +324,7 @@ def getoutgoing(ui, repo, otheruri, othe
         other = hg.peer(repo, {}, otheruri)
     other.ui.pushbuffer() # ignore ui events
     source, branches = hg.parseurl(repo.root, None)
-    try: # FIXME: This breaks on http repos! 
+    try: 
         revs, checkout = hg.addbranchrevs(other, repo, branches, None)
         if revs:
             revs = [repo.lookup(rev) for rev in revs]
@@ -348,6 +352,14 @@ def getforkinfo(ui, target):
         forkinfo[forkname] = forkuri
     return forkinfo
 
+def safeuri(uri):
+    """Shareable uris: Hide password + hide freenet insert keys."""
+    uri = util.hidepassword(uri)
+    freenetpriv = "AQECAAE/"
+    if "USK@" in uri and freenetpriv in uri:
+        uri = "freenet://USK@******" + uri[uri.index(freenetpriv)+len(freenetpriv)-1:]
+    return uri
+
 def getforkdata(ui, repo, target, name, forkname, forkuri):
     """Write the site for a single fork."""
     # make sure the forkdir exists.
@@ -357,7 +369,7 @@ def getforkdata(ui, repo, target, name, 
     html = templates["forkhead"].replace(
             "{forkname}", forkname).replace(
         "{reponame}", name).replace(
-                "{forkuri}", util.hidepassword(forkuri))
+                "{forkuri}", safeuri(forkuri))
 
     # prepare the log templater
     t = cmdutil.changeset_templater(ui, repo, patch=False, diffopts=None, mapfile=None, buffered=False)