summaryrefslogtreecommitdiffstats
path: root/bn_django/git_browse/views.py
blob: c0966b00a0ccc6ed5576f28214355fc368158566 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from django.conf import settings
from django import forms, http, template
from django.contrib.auth.decorators import login_required
from django.shortcuts import get_object_or_404, render_to_response
from django.http import HttpResponse

import os, commands

from models import *

try:
    GITBROWSE_BASE = settings.GITBROWSE_BASE+'/'
except AttributeError:
    GITBROWSE_BASE='/home/'


# Create your views here.

def repo_view(request, repo):
    therepo = get_object_or_404(Repository, slug=repo)
    out_content = 'Repo path: ' + therepo.path + '\n'
    out_content += 'Repo slug: ' + therepo.slug + '\n\n\n\n\n'
    
    out_content += commands.getoutput('cd '+GITBROWSE_BASE+therepo.slug+'; /usr/local/bin/git --git-dir='+GITBROWSE_BASE+therepo.slug+'/.git ls-files')

    return render_to_response('git_browse/repository_raw_output.html',
                      dict(object=therepo,raw_content=out_content))