M gitsrht/app.py => gitsrht/app.py +0 -2
@@ 27,7 27,6 @@ class GitApp(ScmSrhtFlask):
from gitsrht.blueprints.email import mail
from gitsrht.blueprints.manage import manage
from gitsrht.blueprints.repo import repo
- from gitsrht.blueprints.stats import stats
from srht.graphql import gql_blueprint
self.register_blueprint(plumbing)
@@ 35,7 34,6 @@ class GitApp(ScmSrhtFlask):
self.register_blueprint(mail)
self.register_blueprint(manage)
self.register_blueprint(repo)
- self.register_blueprint(stats)
self.register_blueprint(webhooks_notify)
self.register_blueprint(gql_blueprint)
D gitsrht/blueprints/stats.py => gitsrht/blueprints/stats.py +0 -42
@@ 1,42 0,0 @@
-import pygit2
-from datetime import datetime, timedelta
-from flask import Blueprint, render_template
-from gitsrht.git import Repository as GitRepository
-from gitsrht.types import User
-from scmsrht.access import get_repo_or_redir
-from scmsrht.stats import RepoContributions, get_contrib_chart_data
-
-stats = Blueprint('stats', __name__)
-
-def get_contributions(git_repo, tip, since):
- contributions = RepoContributions(User)
-
- since_ts = since.timestamp()
- for commit in git_repo.walk(tip.id, pygit2.GIT_SORT_TIME):
- timestamp = commit.commit_time + commit.commit_time_offset
- if timestamp < since_ts:
- break
-
- user = contributions.get_or_create_user(
- commit.author.email, commit.author.name)
- user.add_commit(timestamp)
-
- return contributions
-
-@stats.route("/<owner>/<repo>/contributors")
-def contributors(owner, repo):
- owner, repo = get_repo_or_redir(owner, repo)
- since = datetime.now() - timedelta(weeks=52)
-
- with GitRepository(repo.path) as git_repo:
- if git_repo.is_empty:
- return render_template("empty-repo.html", owner=owner, repo=repo)
-
- default_branch = git_repo.default_branch()
- tip = git_repo.get(default_branch.target)
- contributions = get_contributions(git_repo, tip, since)
- chart_data = get_contrib_chart_data(contributions)
-
- return render_template("contributors.html", view="contributors",
- owner=owner, repo=repo, chart_data=chart_data,
- default_branch=default_branch)
D gitsrht/templates/contributors.html => gitsrht/templates/contributors.html +0 -16
@@ 1,16 0,0 @@
-{% extends "repo.html" %}
-
-{% block title %}
-<title>
- {{repo.owner.canonical_name}}/{{repo.name}} contributors
- - {{cfg("sr.ht", "site-name")}} git
-</title>
-{% endblock %}
-
-{% block head %}
-{% include "partials/scmcontrib-head.html" %}
-{% endblock %}
-
-{% block content %}
-{% include "partials/scmcontrib-body.html" %}
-{% endblock %}
M gitsrht/templates/repo.html => gitsrht/templates/repo.html +0 -5
@@ 57,11 57,6 @@
owner=repo.owner.canonical_name,
repo=repo.name), "refs")}}
</li>
- <li class="nav-item">
- {{link(url_for("stats.contributors",
- owner=repo.owner.canonical_name,
- repo=repo.name), "contributors")}}
- </li>
{% if current_user.id == repo.owner_id %}
<li class="nav-item">
{{link(url_for("manage.settings_info",