Upgrade release post from note to article and include changes
Committed 1480ec
--- a/webint_code/__init__.py
+++ b/webint_code/__init__.py
]
+def get_release(project, release):
+ """Return a tuple containing files, log, previous release and next release."""
+ pypi_name = app.model.get_project_from_name(project)["pypi"].replace("-", "_")
+ files = sorted(
+ (code_dir / project / "releases" / f"{pypi_name}-{release}").iterdir()
+ )
+
+ 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 files, log, previous_release, next_release
+
+
@app.query
def search(db, query):
"""Search for `query` in commited code."""
def get(self, project, release):
"""Return a view of the package file."""
- pypi_name = app.model.get_project_from_name(project)["pypi"].replace("-", "_")
- files = sorted(
- (code_dir / project / "releases" / f"{pypi_name}-{release}").iterdir()
- )
-
- 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,
+ project, release, *get_release(project, release)
)
web.application("webint_posts").model.create(
"entry",
url=f"{project_prefix}/releases/{release_version}",
- content=(
+ name=(
f"Released <a href={project_prefix}><code>{project['name']}"
f"</code></a> <code>{release_version}</code>"
),
+ content=(
+ "<ul>"
+ + "".join(
+ f"<li>{commit['message'].splitlines()[0]}</li>"
+ for commit in get_release(project, "HEAD")[1].values()
+ )
+ + "</ul>"
+ ),
visibility="public",
)
app.model.create_package(form)