summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-07-23 20:16:52 +0200
committerMatthias Beyer <mail@beyermatthias.de>2019-07-23 20:16:52 +0200
commit836e00f67ba2c67a89a9b62092743c44985a8a2a (patch)
tree154c251d33af8863f715a8afc2476fc445522547
parent61fb547f64f95c7132459a8bce012f4d52237709 (diff)
Add commits-since-tagHEADmaster
This patch adds a "commits since tag" output in the refs view.
-rw-r--r--gitsrht/git.py7
-rw-r--r--gitsrht/templates/refs.html3
2 files changed, 10 insertions, 0 deletions
diff --git a/gitsrht/git.py b/gitsrht/git.py
index e6808b9..0e6f938 100644
--- a/gitsrht/git.py
+++ b/gitsrht/git.py
@@ -12,6 +12,13 @@ def trim_commit(msg):
return msg
return msg[:msg.index("\n")]
+def commits_since_rev(repo, rev):
+ i = 0
+ for commit in repo.walk(repo.head.target):
+ if commit.id == rev:
+ break
+ return i
+
def commit_time(commit):
author = commit.author if hasattr(commit, 'author') else commit.tagger
# Time handling in python is so dumb
diff --git a/gitsrht/templates/refs.html b/gitsrht/templates/refs.html
index 14d0211..e8d1c26 100644
--- a/gitsrht/templates/refs.html
+++ b/gitsrht/templates/refs.html
@@ -46,6 +46,9 @@
</a>
{% endif %}
<small class="pull-right text-muted">
+ <span style="margin-left: 0.5rem">
+ {{commits_since_rev(repo, tag)}}
+ </span>
{{commit_time(tag) | date}}
<a
style="margin-left: 0.5rem"