summaryrefslogtreecommitdiffstats
path: root/g2h/log_page.py
diff options
context:
space:
mode:
authorChristoph Schlosser <christoph@linux.com>2025-09-19 19:21:11 +0200
committerChristoph Schlosser <christoph@linux.com>2025-09-19 19:21:11 +0200
commita3324b7e71ec48daab81981e7d85967a590d4f79 (patch)
treedef4a8d901d9a56047a0e63f5f3d93803c93ee87 /g2h/log_page.py
parentbd403e6ab18d5cc7818e86d43c3ca0b15c5e53a1 (diff)
downloadgit2hugo-a3324b7e71ec48daab81981e7d85967a590d4f79.tar.gz
g2h: Add utility script
Also move the sources into the more conventional src/g2h dir
Diffstat (limited to 'g2h/log_page.py')
-rw-r--r--g2h/log_page.py47
1 files changed, 0 insertions, 47 deletions
diff --git a/g2h/log_page.py b/g2h/log_page.py
deleted file mode 100644
index b8df839..0000000
--- a/g2h/log_page.py
+++ /dev/null
@@ -1,47 +0,0 @@
-import os
-
-from .page import Page
-
-def ref_names_for_commit(refs, commit_sha):
- ref_names = []
- if refs is None:
- return ref_names
- for ref in refs:
- if ref.commit.hexsha == commit_sha:
- ref_names.append(ref.name)
-
- return ref_names
-
-class LogPage(Page):
- def __init__(self, out_dir, name, commits, branches, tags, content_subdir, latest_commit):
- super(LogPage, self).__init__('log.md', out_dir, 'l.md', name, content_subdir)
- self.commits = commits
- self.branches = branches
- self.tags = tags
- self.latest_commit = latest_commit
-
- def _commits_with_refs(self):
- commits_context = []
- for commit in self.commits:
- refs = ref_names_for_commit(self.branches, commit.hexsha) + ref_names_for_commit(self.tags, commit.hexsha)
- commit_context = {
- 'committed_datetime': commit.committed_datetime,
- 'hexsha': commit.hexsha,
- 'refs': refs,
- 'summary': commit.summary
- }
- commits_context.append(commit_context)
- return commits_context
-
- def context(self):
- commits_context = []
- if self.commits is not None:
- commits_context = self._commits_with_refs()
-
- return {
- 'commits': commits_context,
- 'content_subdir': self.content_subdir,
- 'title': self.name + ': Log',
- 'this_commit': self.latest_commit
- }
-