djcev.com

//

Git Repos / blogofile_gitview / commit 23af687

Commit: 23af687919307630d8f7b540d2b259e71c0b7c60
Parent: 7763fd2b5aefa2ad8f5db8b4421ad8cd092e3a6a
Author: Cameron Vanderzanden, 2021-08-01 20:14
Committer: Cameron Vanderzanden, 2021-08-01 20:14

Commit Message

Add missing stats to templates, change tag check

Add commit files changed, lines inserted, lines deleted to
the git commit list template. Add lines inserted and deleted to
the change list on the individual commit view template.

Also switch from using regex to .startswith() in gitview.py.

Change List

Diff _controllers/gitview.py

diff --git a/_controllers/gitview.py b/_controllers/gitview.py
index 0a0b152..6dc9a42 100644
--- a/_controllers/gitview.py
+++ b/_controllers/gitview.py
@@ -13,7 +13,7 @@ under the terms of the MIT License. Please see the file "LICENSE" in
the root dir of this repository for more information.

"""
-import datetime, os, re, shutil, stat, sys
+import datetime, os, shutil, stat, sys
try:
from urllib.parse import urlparse
except ImportError:
@@ -274,9 +274,8 @@ def get_tags(repo, repoinfo):
tl = []
# https://www.pygit2.org/recipes/git-tag.html
# https://github.com/libgit2/pygit2/issues/856
- regex = re.compile("^refs/tags/")
for ref in repo.references:
- if not regex.match(ref): continue
+ if not ref.startswith("refs/tags/"): continue
tag = repo.revparse_single(ref)
author = None
commitid = ""

Return to the top of this page or return to the overview of this repo.

Diff _templates/gitview/git_commit.mako

diff --git a/_templates/gitview/git_commit.mako b/_templates/gitview/git_commit.mako
index 2d88ecc..869103d 100644
--- a/_templates/gitview/git_commit.mako
+++ b/_templates/gitview/git_commit.mako
@@ -38,12 +38,12 @@ ${commitinfo['committer_time'].strftime("%Y-%m-%d %H:%M")}<br />
<td class="filename">
<a href="${commitinfo['id']}.html#${i}">${delta['oldpath']}</a></td>
% if delta['add']:
-<td class="cadd">${delta['add']}</td>
+<td class="cadd">+${delta['add']}</td>
% else:
<td class="cadd"></td>
% endif
% if delta['del']:
-<td class="cdel">${delta['del']}</td>
+<td class="cdel">-${delta['del']}</td>
% else:
<td class="cdel"></td>
% endif

Return to the top of this page or return to the overview of this repo.

Diff _templates/gitview/git_commit_list.mako

diff --git a/_templates/gitview/git_commit_list.mako b/_templates/gitview/git_commit_list.mako
index 64e15fb..7b60173 100644
--- a/_templates/gitview/git_commit_list.mako
+++ b/_templates/gitview/git_commit_list.mako
@@ -2,16 +2,25 @@
<section class="commits"><table><tr>
<th class="commdate">Date</th>
<th class="commmesg">Commit Message</th>
-<th class="commauth">Author</th></tr>
+<th class="commauth">Author</th>
+<th class="commcha">F</th>
+<th class="commins">+</th>
+<th class="commdel">-</th></tr>
% for c in commits:
% if c == None:
<tr><td class="commdate"></td>
<td class="commmesg">More commits remaining [...]</td>
-<td class="commauth"></td></tr>
+<td class="commauth"></td>
+<td class="commcha"></td>
+<td class="commins"></td>
+<td class="commdel"></td></tr>
% else:
<tr><td class="commdate">${c['date'].strftime("%Y-%m-%d")}</td>
<td class="commmesg"><a href="${c['id']}.html">${c['summary']}</a></td>
-<td class="commauth">${c['author']}</td></tr>
+<td class="commauth">${c['author']}</td>
+<td class="commcha">${c['ds_changed']}</td>
+<td class="commins">+${c['ds_insert']}</td>
+<td class="commdel">-${c['ds_delete']}</td></tr>
% endif
% endfor
</table></section>\

Return to the top of this page or return to the overview of this repo.

Diff css/style.css

diff --git a/css/style.css b/css/style.css
index 87c6a67..d1cbae7 100644
--- a/css/style.css
+++ b/css/style.css
@@ -7,11 +7,17 @@ span[id^='ln-']:before { color: #8c8c8c; text-align: right;
/* gitview commit list, diff list, and file list */
section.changelist, section.commits, section.diff, section.files,
section.repolist, section.branches, section.tags {
- font-family: 'Inconsolata', monospace; font-size: 1em; }
-.filemode, .filesize, .cstatus, .cadd, .cdel, .reponame, .repoauth,
-.repodate, .commdate, .commauth, .tagname, .taglast, .tagauth, .branchname,
-.branchlast, .branchauth { padding: 0 0.5em 0 0.5em; vertical-align: top;
- white-space: nowrap; }
+ font-family: 'Inconsolata', monospace; font-size: 1em; }
+.commdate, .filemode, .reponame, .branchauth, .tagauth, .cstatus {
+ padding: 0 0.5em 0 0.5em; }
+.commauth, .branchname, .tagname, .cadd { padding: 0 0.25em 0 0.5em; }
+.commcha, .commins, .repoauth { padding: 0 0.25em 0 0.25em; }
+.commdel, .filesize, .repodate, .branchlast, .taglast, .cdel {
+ padding: 0 0.5em 0 0.25em; }
+.commdate, .commauth, .commcha, .commins, .commdel, .filemode, .filesize,
+.reponame, .repoauth, .repodate, .branchname, .branchlast, .branchauth,
+.tagname, .taglast, .tagauth, .cstatus, .cadd, .cdel {
+ vertical-align: top; white-space: nowrap; }
.filename, .commmesg, .repodesc, .tagsummary, .branchsummary { width: 100%; }
-.commauth, .filesize, .repodate, .tagauth, .branchauth, .cadd, .cdel {
- text-align: right; }
+.cadd, .cdel, .commauth, .commcha, .commins, .commdel, .filesize, .repoauth,
+.repodate, .tagauth, .branchauth { text-align: right; }

Return to the top of this page or return to the overview of this repo.