forked from asottile/git-code-debt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommit.py
More file actions
38 lines (28 loc) · 952 Bytes
/
Copy pathcommit.py
File metadata and controls
38 lines (28 loc) · 952 Bytes
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
29
30
31
32
33
34
35
36
37
38
from __future__ import absolute_import
from __future__ import unicode_literals
import flask
from git_code_debt.server.presentation.commit_delta import CommitDelta
from git_code_debt.server.presentation.delta import Delta
from git_code_debt.server.render_mako import render_template
commit = flask.Blueprint('commit', __name__)
@commit.route('/commit/<sha>')
def show(sha):
changes = flask.g.db_logic.get_metric_changes(sha)
commit_deltas = sorted(
CommitDelta.from_data(
metric_name, Delta('javascript:;', change),
color_overrides=flask.g.config.color_overrides,
)
for metric_name, change in changes
)
links = [
(link_name, link.format(sha=sha))
for link_name, link in flask.g.config.commit_links
]
return render_template(
'commit.mako',
sha=sha,
short_sha=sha[:8],
commit_deltas=commit_deltas,
links=links,
)