aboutsummaryrefslogtreecommitdiffstats
path: root/bn_django/git_browse/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'bn_django/git_browse/views.py')
-rw-r--r--bn_django/git_browse/views.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/bn_django/git_browse/views.py b/bn_django/git_browse/views.py
index 1f1b03c..79b3573 100644
--- a/bn_django/git_browse/views.py
+++ b/bn_django/git_browse/views.py
@@ -144,3 +144,16 @@ def view_obj(request, repo, hash, branch=None):
type=obj_type,
size=float(obj_size),
contents=obj_contents))
+
+def zip(request, repo, hash):
+ therepo = get_object_or_404(Repository, slug=repo)
+ (GITPREFIX, heads, tags) = therepo.scan()
+ t = Tree(id=hash,repo=therepo)
+ t.update()
+
+ hr = HttpResponse(mimetype="application/zip")
+ hr['Content-Disposition'] = 'filename=%s.zip' % t.id
+ archive = commands.getoutput(GITPREFIX + \
+ ' archive --format=zip ' + hash + ' | cat')
+ hr.write(archive)
+ return hr