Beispiel #1
0
def commits_stats(request, username, repository):
    """
        Returns number of commits for the given repository.
    """

    repo = Repo(Repo.get_repository_location(username, repository))
    stats = GitStatistics(repo, repo.get_head())

    return HttpResponse(json.dumps({'weekly': stats.for_commits(weekly, js), 'monthly': stats.for_commits(monthly, js)}))
Beispiel #2
0
def commits_stats(request, username, repository):
    """
        Returns number of commits for the given repository.
    """

    repo = Repo(Repo.get_repository_location(username, repository))
    stats = GitStatistics(repo, repo.get_head())

    return HttpResponse(
        json.dumps({
            'weekly': stats.for_commits(weekly, js),
            'monthly': stats.for_commits(monthly, js)
        }))
Beispiel #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
        })