This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git
The following commit(s) were added to refs/heads/main by this push:
new 32ce56c Add revision information to the evaluation page header
32ce56c is described below
commit 32ce56c30f94a3498a911acdd5ab547120b70674
Author: Sean B. Palmer <[email protected]>
AuthorDate: Wed Apr 9 16:03:42 2025 +0100
Add revision information to the evaluation page header
---
atr/revision.py | 21 +++++++++++++++++++++
atr/routes/draft.py | 4 ++++
atr/templates/draft-evaluate.html | 10 ++++++++++
3 files changed, 35 insertions(+)
diff --git a/atr/revision.py b/atr/revision.py
index 95e6bc7..6a58875 100644
--- a/atr/revision.py
+++ b/atr/revision.py
@@ -109,6 +109,27 @@ async def create_and_manage(
await aioshutil.rmtree(new_revision_dir) # type:
ignore[call-arg]
+async def latest_info(project_name: str, version_name: str) -> tuple[str |
None, datetime.datetime | None]:
+ """Get the editor and timestamp of the latest revision from the
filesystem."""
+ editor: str | None = None
+ timestamp: datetime.datetime | None = None
+
+ with contextlib.suppress(OSError, FileNotFoundError, ValueError):
+ draft_base_dir = util.get_release_candidate_draft_dir()
+ release_dir = draft_base_dir / project_name / version_name
+ latest_symlink_path = release_dir / "latest"
+
+ if await aiofiles.os.path.islink(latest_symlink_path):
+ revision_name = await
aiofiles.os.readlink(str(latest_symlink_path))
+ parts = revision_name.split("@", 1)
+ if len(parts) == 2:
+ editor = parts[0]
+ dt_obj = datetime.datetime.strptime(parts[1][:-1],
"%Y-%m-%dT%H.%M.%S.%f")
+ timestamp = dt_obj.replace(tzinfo=datetime.UTC)
+
+ return editor, timestamp
+
+
async def _manage_draft_revision_find_parent(
release_dir: pathlib.Path, latest_symlink_path: pathlib.Path
) -> tuple[pathlib.Path | None, str | None]:
diff --git a/atr/routes/draft.py b/atr/routes/draft.py
index 71efbc1..6700d22 100644
--- a/atr/routes/draft.py
+++ b/atr/routes/draft.py
@@ -411,6 +411,8 @@ async def evaluate(session: routes.CommitterSession,
project_name: str, version_
# if (latest_check_result is None) or (check_result.created >
latest_check_result):
# latest_check_result = check_result.created
+ revision_editor, revision_time = await revision.latest_info(project_name,
version_name)
+
delete_file_form = await DeleteFileForm.create_form()
return await quart.render_template(
"draft-evaluate.html",
@@ -432,6 +434,8 @@ async def evaluate(session: routes.CommitterSession,
project_name: str, version_
modified=path_modified,
models=models,
delete_file_form=delete_file_form,
+ revision_editor=revision_editor,
+ revision_time=revision_time,
)
diff --git a/atr/templates/draft-evaluate.html
b/atr/templates/draft-evaluate.html
index 1ba1cf3..c392491 100644
--- a/atr/templates/draft-evaluate.html
+++ b/atr/templates/draft-evaluate.html
@@ -32,6 +32,11 @@
<p>
<strong>Label:</strong> {{ release.name }}
</p>
+ {% if revision_editor %}
+ <p>
+ <strong>Revision editor:</strong> {{ revision_editor }}
+ </p>
+ {% endif %}
</div>
<div class="col-md-6">
<p>
@@ -43,6 +48,11 @@
<p>
<strong>Created:</strong> {{ release.created.strftime("%Y-%m-%d
%H:%M:%S") }}
</p>
+ {% if revision_time %}
+ <p>
+ <strong>Revision:</strong> {{ revision_time.strftime("%Y-%m-%d
%H:%M:%S") }}
+ </p>
+ {% endif %}
</div>
</div>
</div>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]