diff --git a/pygit/pygit.py b/pygit/pygit.py index 8b0d229..57a2280 100644 --- a/pygit/pygit.py +++ b/pygit/pygit.py @@ -161,3 +161,7 @@ def commit_message(rid,cid): r = open_repo(rid) c = r.commit(cid) return c.message + +def commit(rid,cid): + r = open_repo(rid) + return r.commit(cid) diff --git a/pygit/views.py b/pygit/views.py index a2ca5b9..9fb3abd 100644 --- a/pygit/views.py +++ b/pygit/views.py @@ -93,7 +93,10 @@ def format_diff(diff): return diff[0], '\n'.join(map(format_line,lines)), diff[2] def diff_file(request,rid,branch,cid,path): - message = pygit.commit_message(rid,cid) + commit = pygit.commit(rid,cid) + message = commit.message + author = commit.author.name + date = pygit.date(commit.authored_date) total,files = pygit.commit_stats(rid,cid) ds = pygit.diff_path(rid,path,cid) if ds: @@ -102,6 +105,8 @@ def diff_file(request,rid,branch,cid,path): ds = map(format_diff,ds) return render_it('git_diff.html', {'repo': repo, + 'author': author, + 'date': date, 'message': message, 'branch': branch, 'path': path, @@ -111,7 +116,10 @@ def diff_file(request,rid,branch,cid,path): request) def diff_all(request,rid,branch,cid): - message = pygit.commit_message(rid,cid) + commit = pygit.commit(rid,cid) + message = commit.message + author = commit.author.name + date = pygit.date(commit.authored_date) total,files = pygit.commit_stats(rid,cid) ds = pygit.diff_all(rid,cid) if ds: @@ -120,6 +128,8 @@ def diff_all(request,rid,branch,cid): ds = map(format_diff,ds) return render_it('git_diff.html', {'repo': repo, + 'author': author, + 'date': date, 'message': message, 'branch': branch, 'path': None, diff --git a/templates/git_diff.html b/templates/git_diff.html index 58fb4ed..4df4822 100644 --- a/templates/git_diff.html +++ b/templates/git_diff.html @@ -6,6 +6,7 @@ <h2>Diff: #{{cid}}{% if path %} {{path}}{% endif %}</h2> <p><a href='{% url pygit.views.diff_all repo.rid,branch,cid %}'>Коммит: {{message}}</a></p> +<p>Автор: {{author}}, дата: {{date}}</p> <p>Всего файлов: {{total_stats.files}}, всего строк: {{total_stats.lines}}, всего новых строк: {{total_stats.insertions}}, всего удалено строк: {{total_stats.deletions}}</p> {% autoescape off %}