diff options
-rw-r--r-- | gitsrht/git.py | 7 | ||||
-rw-r--r-- | gitsrht/templates/refs.html | 3 |
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" |