summaryrefslogtreecommitdiffstats
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.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/bn_django/git_browse/views.py b/bn_django/git_browse/views.py
index 9e3ba90..c8a7a40 100644
--- a/bn_django/git_browse/views.py
+++ b/bn_django/git_browse/views.py
@@ -27,20 +27,24 @@ def repo_info(request, repo,branch=None):
GITPREFIX = 'cd ' + GITBROWSE_BASE + therepo.slug + '; ' + GITCOMMAND + ' --git-dir=' + GITBROWSE_BASE + therepo.slug + '/.git '
shortlog = commands.getoutput(GITPREFIX + ' log | ' + GITCOMMAND + '-shortlog')
+ filelist = commands.getoutput(GITPREFIX + ' ls-files')
return render_to_response('git_browse/repository_info.html',
dict(object=therepo,
+ filelist=filelist,
shortlog=shortlog,))
-def view_tree(request, repo, tree_hash=None,branch=None):
+def view_tree(request, repo, hash=None,branch=None):
therepo = get_object_or_404(Repository, slug=repo)
GITPREFIX = 'cd ' + GITBROWSE_BASE + therepo.slug + '; ' + GITCOMMAND + ' --git-dir=' + GITBROWSE_BASE + therepo.slug + '/.git '
- head_ref = commands.getoutput('cd ' + GITBROWSE_BASE + therepo.slug +'/.git; cat HEAD')
- head_ref = head_ref.split()[1]
- head = commands.getoutput('cd ' + GITBROWSE_BASE + therepo.slug +'/.git; cat ' + head_ref)
- tree_ls = commands.getoutput(GITPREFIX + ' ls-tree ' + head)
+ if(hash == None):
+ head_ref = commands.getoutput('cd ' + GITBROWSE_BASE + therepo.slug +'/.git; cat HEAD')
+ head_ref = head_ref.split()[1]
+ hash = commands.getoutput('cd ' + GITBROWSE_BASE + therepo.slug +'/.git; cat ' + head_ref)
+
+ tree_ls = commands.getoutput(GITPREFIX + ' ls-tree ' + hash)
tree_objs = list()
blob_objs = list()
for line in tree_ls.splitlines():
@@ -56,6 +60,7 @@ def view_tree(request, repo, tree_hash=None,branch=None):
dict(object=therepo,
blob_objs=blob_objs,
tree_objs=tree_objs,
+ hash=hash,
all_objs=tree_objs+blob_objs,))
def view_log(request, repo, tree_hash=None, branch=None):