hg site extension
 
(Arne Babenhauserheide)
2011-10-20: added a raw link to the manifests.

added a raw link to the manifests.

diff --git a/static.py b/static.py
--- a/static.py
+++ b/static.py
@@ -194,6 +194,10 @@ def srcpath(target, ctx, filename):
     """Get the relative path to the static sourcefile for an already escaped filename."""
     return join(target,"src",ctx.hex(),filename+".html")
 
+def rawpath(target, ctx, filename):
+    """Get the relative path to the static sourcefile for an already escaped filename."""
+    return join(target,"raw",ctx.hex(),filename)
+
 def createindex(target, ctx):
     """Create an index page for the changecontext: the commit message + the user + all files in the changecontext."""
     # first the head
@@ -206,11 +210,10 @@ def createindex(target, ctx):
     for filename in ctx:
         filectx = ctx[filename]
         lasteditctx = filectx.filectx(filectx.filerev())
-        index += "<li><a href='../../../"+ srcpath(target, lasteditctx, escapename(filename)) + "'>" + filename + "</a></li>"
+        index += "<li><a href='../../../"+ srcpath(target, lasteditctx, escapename(filename)) + "'>" + filename + "</a> (<a href='../../../" + rawpath(target, lasteditctx, filename) + "'>raw</a>)</li>"
     index += "</ul>"
     return index
 
-
 def writesourcetree(ui, repo, target, name, force):
     """Write manifests for all commits and websites for all files.
 
@@ -223,7 +226,7 @@ def writesourcetree(ui, repo, target, na
         for filename in ctx.files():
             filectx = ctx[filename]
             # first write the raw data
-            filepath = join(target,"raw",ctx.hex(),filectx.path())
+            filepath = rawpath(target,ctx,filectx.path())
             # skip already existing files
             if not force and isfile(filepath):
                 continue