talwrii_plugin-repl/release-changes
2025-02-14 16:39:56 +01:00

23 lines
818 B
Python
Executable file

#!/usr/bin/python3
# Versions is a file that contains versions.json
# llm context: versions.json
# I want to get the last version and then so the git commits since this version
# Call git log with an exec call so that this process becomes a git process
# The versions are git tags
import subprocess
import re
# Get git tags that look like \d+.\d+.\d+ using git
*_, last_version = sorted([x for x in subprocess.check_output(["git", "tag"]).decode('utf8').splitlines() if re.match(r"\d+.\d+.\d+", x)])
# Get the commit hash from the last version
commit_hash = subprocess.check_output(['git', 'rev-list', '-n', '1', last_version]).decode('utf-8').strip()
# Get the git commits since the last version
git_log = subprocess.check_output(['git', 'log', '{}..HEAD'.format(commit_hash)]).decode('utf-8')
print(git_log)