Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 30 additions & 25 deletions src/caelestia/utils/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,34 @@ def print_version() -> None:
local_shell_dir = config_dir / "quickshell/caelestia"
if local_shell_dir.exists():
print("\nLocal copy of shell found:")
if (local_shell_dir / ".git").exists():
try:
shell_ver = subprocess.check_output(
[
"git",
"--git-dir",
local_shell_dir / ".git",
"rev-list",
"--format=%B",
"--max-count=1",
"upstream/main",
],
text=True,
stderr=subprocess.DEVNULL,
)
print(" Last merged upstream commit:", shell_ver.split()[1])
print(" Commit message:", *shell_ver.splitlines()[1:])
except subprocess.CalledProcessError:
print(" Unable to determine last merged upstream commit.")

try:
shell_ver = subprocess.check_output(
[
"git",
"--git-dir",
local_shell_dir / ".git",
"rev-list",
"--format=%B",
"--max-count=1",
"upstream/main",
],
text=True,
stderr=subprocess.DEVNULL,
)
print(" Last merged upstream commit:", shell_ver.split()[1])
print(" Commit message:", *shell_ver.splitlines()[1:])
except subprocess.CalledProcessError:
print(" Unable to determine last merged upstream commit.")

shell_ver = subprocess.check_output(
["git", "--git-dir", local_shell_dir / ".git", "rev-list", "--format=%B", "--max-count=1", "HEAD"],
text=True,
)
print("\n Last commit:", shell_ver.split()[1])
print(" Commit message:", *shell_ver.splitlines()[1:])
try:
shell_ver = subprocess.check_output(
["git", "--git-dir", local_shell_dir / ".git", "rev-list", "--format=%B", "--max-count=1", "HEAD"],
text=True,
)
print("\n Last commit:", shell_ver.split()[1])
print(" Commit message:", *shell_ver.splitlines()[1:])
except subprocess.CalledProcessError:
print("\n Unable to determine last commit.")
else:
print(" Not a git repository.")