my eye

Show related commits on project release page

Committed 92ee04

--- a/webint_code/__init__.py
+++ b/webint_code/__init__.py

         files = sorted(
             (code_dir / project / "releases" / f"{pypi_name}-{release}").iterdir()
         )
-        return app.view.project.release(project, release, files)
+
+        package_releases = get_package_releases(project)
+        previous_release = None
+        for package_release, _ in reversed(package_releases):
+            if release == package_release:
+                break
+            previous_release = package_release
+        next_release = None
+        for package_release, _ in package_releases:
+            if release == package_release:
+                break
+            next_release = package_release
+        repo = gmpg.get_repo(code_dir / project / "source.git")
+        log = None
+        if previous_release:
+            log = repo.log(f"{previous_release}..{release}")
+        return app.view.project.release(
+            project,
+            release,
+            files,
+            log,
+            previous_release,
+            next_release,
+        )
 
 
 @app.control("projects/{project}/releases/{release}/files(/{filename})?")

--- a/webint_code/templates/project/release.html
+++ b/webint_code/templates/project/release.html

-$def with (project, release, files)
+$def with (project, release, files, log, prev, next)
 $var breadcrumbs = ("projects", "Projects", project, f"<b>{project}</b>", "releases", "Releases")
 $var title: $project $release
 $var body_classes = ["h-entry"]
 $for file in sorted(files):
     <li><a href=/projects/$project/releases/$release/files/$file.name>$file.name</a></li>
 </ul>
+
+$if log:
+    $for _, entry in list(log.items())[1:]:
+        <p>$entry["message"] <small><a href=/projects/$project/commits/$entry["hash"]>$entry["timestamp"].diff_for_humans()</a></small></p>
+
+$def aside():
+    <p>
+    $if not (prev or next):
+        no other releases
+    $if prev:
+        <a rel=prev href=/projects/$project/releases/$prev>$prev</a>
+    $if prev and next:
+        &mdash;
+    $if next:
+        <a rel=next href=/projects/$project/releases/$next>$next</a>
+    </p>
+$var aside = aside()