Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

Commit

Permalink
Changelog displayed on upgrade (#523)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakethekoenig authored Feb 14, 2024
1 parent c0c1441 commit 0b1f711
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions mentat/splash_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import requests

from mentat.session_context import SESSION_CONTEXT
from mentat.utils import mentat_dir_path


def get_changelog() -> Optional[str]:
Expand Down Expand Up @@ -57,5 +58,23 @@ def check_version():
"Upgrade for the following features/improvements:", style="warning"
)
ctx.stream.send(changelog, style="warning")

else:
last_version_check_file = mentat_dir_path / "last_version_check"
if last_version_check_file.exists():
with open(last_version_check_file, "r") as f:
last_version_check = f.read()
if packaging.version.parse(
last_version_check
) < packaging.version.parse(current_version):
changelog = get_latest_changelog()
if changelog:
ctx.stream.send(
f"Thanks for upgrading to v{current_version}.", style="info"
)
ctx.stream.send("Changes in this version:", style="info")
ctx.stream.send(changelog, style="info")
with open(last_version_check_file, "w") as f:
f.write(current_version)
except Exception as err:
ctx.stream.send(f"Error checking for most recent version: {err}", style="error")

0 comments on commit 0b1f711

Please sign in to comment.