mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-21 04:44:59 +00:00
refactor: Use latest version header in HISTORY.md for git log range
This commit is contained in:
parent
37d867e47e
commit
0cee8bc6ac
1 changed files with 12 additions and 9 deletions
|
@ -10,22 +10,25 @@ from history_prompts import history_prompt
|
||||||
from aider import __version__
|
from aider import __version__
|
||||||
|
|
||||||
|
|
||||||
def get_base_version():
|
def get_latest_version_from_history():
|
||||||
# Parse current version like "0.64.2.dev" to get major.minor
|
with open("HISTORY.md", "r") as f:
|
||||||
match = re.match(r"(\d+\.\d+)", __version__)
|
history_content = f.read()
|
||||||
|
|
||||||
|
# Find most recent version header
|
||||||
|
match = re.search(r'### Aider v(\d+\.\d+\.\d+)', history_content)
|
||||||
if not match:
|
if not match:
|
||||||
raise ValueError(f"Could not parse version: {__version__}")
|
raise ValueError("Could not find version header in HISTORY.md")
|
||||||
return match.group(1) + ".0"
|
return match.group(1)
|
||||||
|
|
||||||
|
|
||||||
def run_git_log():
|
def run_git_log():
|
||||||
base_ver = get_base_version()
|
latest_ver = get_latest_version_from_history()
|
||||||
cmd = [
|
cmd = [
|
||||||
"git",
|
"git",
|
||||||
"log",
|
"log",
|
||||||
"-p",
|
"-p",
|
||||||
"--pretty=full",
|
"--pretty=full",
|
||||||
f"v{base_ver}..HEAD",
|
f"v{latest_ver}..HEAD",
|
||||||
"--",
|
"--",
|
||||||
"aider/",
|
"aider/",
|
||||||
":!aider/website/",
|
":!aider/website/",
|
||||||
|
@ -41,12 +44,12 @@ def main():
|
||||||
diff_content = run_git_log()
|
diff_content = run_git_log()
|
||||||
|
|
||||||
# Extract relevant portion of HISTORY.md
|
# Extract relevant portion of HISTORY.md
|
||||||
base_ver = get_base_version()
|
latest_ver = get_latest_version_from_history()
|
||||||
with open("HISTORY.md", "r") as f:
|
with open("HISTORY.md", "r") as f:
|
||||||
history_content = f.read()
|
history_content = f.read()
|
||||||
|
|
||||||
# Find the section for this version
|
# Find the section for this version
|
||||||
version_header = f"### Aider v{base_ver}"
|
version_header = f"### Aider v{latest_ver}"
|
||||||
start_idx = history_content.find("# Release history")
|
start_idx = history_content.find("# Release history")
|
||||||
if start_idx == -1:
|
if start_idx == -1:
|
||||||
raise ValueError("Could not find start of release history")
|
raise ValueError("Could not find start of release history")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue