#
#
# patch "index.psp"
# from [cc99e564d6cd74b36e6f02933716835ef785d73f]
# to [4d51e2425e0b157425e6360e97268c15712f43b3]
#
# patch "monotone.py"
# from [3e1d8c9c725753c7b0fea0c32d7e3507c88dec90]
# to [7f1c3f7f328134e117328056199a1a092d0f9583]
#
# patch "revision.psp"
# from [8369faff90b1d2f2e5aafdb0830ee1f618ff1aa0]
# to [4ccdde4c1dc7c9c9ba01179b4eb90e18fcd4271f]
#
# patch "template.py"
# from [5fa8881d0de41240ce269ee7c872954e93781c15]
# to [6fab3a1035e55b14f3bbb5babe1ec318afad673e]
#
# patch "wrapper.py"
# from [05e242fb81e6c4fbed7bcedfbf4467ae67486e70]
# to [facbfdf96cbd2fc3dcf30bd514b8337e124fab3a]
#
============================================================
--- index.psp cc99e564d6cd74b36e6f02933716835ef785d73f
+++ index.psp 4d51e2425e0b157425e6360e97268c15712f43b3
@@ -12,14 +12,14 @@
reload(monotone)
psp.set_error_page("error.psp")
-info = { 'title' : "List of branches" }
+info = { 'title' : "Branches and Tags" }
req.write(header(info))
hq = common.html_escape()
mt = Monotone(config.monotone, config.dbfile)
-
branches = mt.branches()
+tags = mt.tags()
%>
@@ -41,12 +41,45 @@
revision.
+
+Branch |
<%
for branch in branches:
- req.write('%s
' % (urllib.quote(branch), hq(branch)))
+ req.write('%s |
' % (urllib.quote(branch), hq(branch)))
+
%>
+
+Tags
+
<%
+if len(tags) == 0:
+%>
+
+There are no tags in the provided monotone database.
+
+<%
+else:
+%>
+
+To view a particular tag, select it from the list of tags contained
+in this Monotone database.
+
+
+
+Tag | Signed by |
+<%
+ for tag in tags:
+ req.write('%s | %s |
' % (urllib.quote(tag[1]), hq(tag[0]), hq(tag[2])))
+
+%>
+
+
+<%
+
+%>
+
+<%
req.write(template.footer(info))
%>
============================================================
--- monotone.py 3e1d8c9c725753c7b0fea0c32d7e3507c88dec90
+++ monotone.py 7f1c3f7f328134e117328056199a1a092d0f9583
@@ -29,6 +29,12 @@
raise Exception("Unable to list branches: %s" % (result['childerr']))
else:
return filter(None, result['fromchild'].split('\n'))
+ def tags(self):
+ result = utility.run_command(self.base_command + " ls tags")
+ if result['exitcode'] != 0:
+ raise Exception("Unable to list tags: %s" % (result['childerr']))
+ else:
+ return map(lambda x: x.split(' ', 2), filter(None, result['fromchild'].split('\n')))
def heads(self, branch):
result = utility.run_command(self.base_command + " automate heads %s" % (pipes.quote(branch)))
if result['exitcode'] != 0:
============================================================
--- revision.psp 8369faff90b1d2f2e5aafdb0830ee1f618ff1aa0
+++ revision.psp 4ccdde4c1dc7c9c9ba01179b4eb90e18fcd4271f
@@ -64,6 +64,7 @@
No manifest is associated with this revision.
<%
else:
+ gettar='gettar.py?id=%s' % (urllib.quote(revision['new_manifest']))
manifest = mt.manifest(revision['new_manifest'])
%>
@@ -77,6 +78,9 @@
<%
%>
+
+This manifest is also available for download in a single archive: tar
+
<%
req.write(footer(info))
============================================================
--- template.py 5fa8881d0de41240ce269ee7c872954e93781c15
+++ template.py 6fab3a1035e55b14f3bbb5babe1ec318afad673e
@@ -11,11 +11,9 @@
-
%(title)s
""" % (info)
============================================================
--- wrapper.py 05e242fb81e6c4fbed7bcedfbf4467ae67486e70
+++ wrapper.py facbfdf96cbd2fc3dcf30bd514b8337e124fab3a
@@ -1,6 +1,9 @@
from mod_python import apache,psp,util
+import monotone
+reload(monotone)
from monotone import Monotone
+import tarfile
import config
import os
import re
@@ -18,8 +21,43 @@
req.write(mt.file(id))
return apache.OK
+def get_tar(req):
+ class DummyFile:
+ def __init__(self, buf):
+ self.buf = buf
+ def seek(a, b):
+ return
+ def read(self, size):
+ return self.buf
+ def write(self, s):
+ self.buf += s
+ "make a tar file out of a given manifest ID"
+ mt = Monotone(config.monotone, config.dbfile)
+ form = util.FieldStorage(req)
+ if not form.has_key('id'):
+ return apache.HTTP_BAD_REQUEST
+ id = form['id']
+ tar_file = DummyFile("")
+ tf = tarfile.TarFile(mode="w", fileobj=tar_file)
+ for id, filename in mt.manifest(id):
+ data = mt.file(id)
+ ti = tarfile.TarInfo()
+ ti.mode = 0x0644
+ ti.mtime = 0
+ ti.type = tarfile.REGTYPE
+ ti.uid = 0
+ ti.gid = 0
+ ti.name = filename
+ ti.size = len(data)
+ tf.addfile(ti, DummyFile(data))
+ tf.add('/etc/passwd')
+ tf.close()
+ req.write(tar_file.buf)
+ return apache.OK
+
handlers = {
- 'getfile.py' : get_file
+ 'getfile.py' : get_file,
+ 'gettar.py' : get_tar
}
def handler(req):
@@ -37,8 +75,5 @@
return apache.OK
except ValueError:
return apache.HTTP_NOT_FOUND
- req.content_type = "text/plain"
- req.write("%s" % (os.getcwd()))
- req.write("URI refers to unknown content handler: %s" % (uri))
- return apache.OK
+ return apache.HTTP_NOT_FOUND