#
#
# patch "fileinbranch.psp"
# from [4da3d1d5c4ad59223943bb947f6074ab030b64ca]
# to [55bc1914c9ba9db154566791809977fd01dc45ed]
#
# patch "revision.psp"
# from [7f933a135197c878bb614f4c25ab23f36f7073a5]
# to [3c361c7a765988f8db206b5bf5a610a6278fa8c9]
#
# patch "wrapper.py"
# from [6d454cd8ae51160cd5807253abdeae764713887a]
# to [83c5abf5583cadb41e9e10d1c517326599749045]
#
============================================================
--- fileinbranch.psp 4da3d1d5c4ad59223943bb947f6074ab030b64ca
+++ fileinbranch.psp 55bc1914c9ba9db154566791809977fd01dc45ed
@@ -52,7 +52,7 @@
break
last = file_revision
if unique:
- psp.redirect("getfile.py?id=%s" % (urllib.quote(values[0])))
+ psp.redirect("getfile.py?id=%s&path=%s" % (urllib.quote(values[0]), urllib.quote(path)))
else:
hq = common.html_escape()
info = {'title' : "Latest version of %s in branch %s" % (hq(path), hq(branch))}
@@ -67,7 +67,7 @@
Revision ID | View file |
<%
for id in file_version.keys():
- req.write('%s | view |
' % (urllib.quote(id), hq(id), urllib.quote(file_version[id])))
+ req.write('%s | view |
' % (urllib.quote(id), hq(id), urllib.quote(file_version[id]), urllib.quote(path)))
req.write(template.footer(info))
%>
============================================================
--- revision.psp 7f933a135197c878bb614f4c25ab23f36f7073a5
+++ revision.psp 3c361c7a765988f8db206b5bf5a610a6278fa8c9
@@ -72,9 +72,9 @@
if type == "patch":
fname, from_id, to_id = stanza[0][1], stanza[1][1], stanza[2][1]
if not from_id:
- value += 'Add file %s with revision %s
' % (hq(fname), urllib.quote(to_id), hq(to_id))
+ value += 'Add file %s with revision %s
' % (hq(fname), urllib.quote(to_id), urllib.quote(fname), hq(to_id))
else:
- value += 'Patch file %s from %s to %s (diff)
' % (hq(fname), urllib.quote(from_id), hq(from_id), urllib.quote(to_id), hq(to_id), urllib.quote(old_revision), urllib.quote(id), urllib.quote(fname))
+ value += 'Patch file %s from %s to %s (diff)
' % (hq(fname), urllib.quote(from_id), urllib.quote(fname), hq(from_id), urllib.quote(to_id), urllib.quote(fname), hq(to_id), urllib.quote(old_revision), urllib.quote(id), urllib.quote(fname))
elif type == "old_revision":
old_revision, old_manifest = stanza[0][1], stanza[1][1]
value += 'Old revision is: %s (diff)
Old manifest: %s
' % (urllib.quote(old_revision), hq(old_revision), urllib.quote(old_revision), urllib.quote(id), hq(old_manifest))
@@ -147,7 +147,7 @@
for id, filename in manifest:
%>
- <%='%s' % (urllib.quote(id), hq(filename))%> |
+ <%='%s' % (urllib.quote(id), urllib.quote(filename), hq(filename))%> |
<%
============================================================
--- wrapper.py 6d454cd8ae51160cd5807253abdeae764713887a
+++ wrapper.py 83c5abf5583cadb41e9e10d1c517326599749045
@@ -1,7 +1,8 @@
from mod_python import apache,psp,util
import config
import monotone
+import mimetypes
from monotone import Monotone
import template
import tarfile
@@ -29,7 +30,11 @@
id = form['id']
if not monotone.is_valid_id(id):
return apache.HTTP_BAD_REQUEST
- req.content_type = "text/plain"
+ mime_type = None
+ if form.has_key('path'):
+ mime_type = mimetypes.guess_type(form['path'])[0]
+ if mime_type == None: mime_type = "text/plain"
+ req.content_type = mime_type
req.write(mt.file(id))
return apache.OK
@@ -68,6 +73,7 @@
id = form['id']
tar_file = DummyFile("")
tar_file_name = "%s.tgz" % (id)
+ req.content_type = 'application/x-tar'
req.headers_out["Content-Disposition"] = "attachment; filename=%s" % tar_file_name
tf = tarfile.open(mode="w", fileobj=tar_file)
for fileid, filename in mt.manifest(id):