コード例 #1
0
 def _decorator(request, *args, **kwargs):
     try:
         repo = Repo(Repo.get_repository_location(kwargs['username'], kwargs['repository']))
         branches = repo.get_branches()
         if 'rev' not in kwargs or kwargs['rev'] in branches + ['HEAD']:
             return func(request, *args, **kwargs)
         else:
             raise Http404()
     except:
         raise Http404()
コード例 #2
0
def repository_graphs(request, username, repository):
    """
        View for viewing commits for repository.
    """

    requested_repo = Repo(Repo.get_repository_location(username, repository))
    branches = requested_repo.get_branches()

    return render(
        request, 'repository/repo-pjax.html', {
            'template': 'graphs',
            'repo_owner': username,
            'repo_name': repository,
            'repo_lsmsg': requested_repo.get_latest_status,
            'num_branches': len(branches)
        })
コード例 #3
0
def repository_branches(request, username, repository):
    """
        View for viewing branches for repository.
    """

    requested_repo = Repo(Repo.get_repository_location(username, repository))
    branches = requested_repo.get_branches()
    return render(
        request, 'repository/repo-pjax.html', {
            'template': 'branches',
            'repo_owner': username,
            'repo_name': repository,
            'num_branches': len(branches),
            'HEAD': requested_repo.get_head(),
            'branches': branches
        })
コード例 #4
0
def repository_commits(request, username, repository):
    """
        View for viewing commits for repository.
    """

    requested_repo = Repo(Repo.get_repository_location(username, repository))
    commits = {
        branch: requested_repo.get_commits(branch)
        for branch in requested_repo.get_branches()
    }
    return render(
        request, 'repository/repo-pjax.html', {
            'template': 'commits',
            'repo_owner': username,
            'repo_name': repository,
            'commits': commits
        })