feat: extract history content up to end of base version section

This commit is contained in:
Paul Gauthier (aider) 2024-11-30 13:59:51 -08:00
parent 24bd016a1a
commit cef333a01c

View file

@ -48,7 +48,19 @@ def main():
if start_idx == -1:
raise ValueError("Could not find start of release history")
relevant_history = history_content[start_idx:]
# Find where this version's section ends
version_idx = history_content.find(version_header, start_idx)
if version_idx == -1:
raise ValueError(f"Could not find version header: {version_header}")
# Find the next version header after this one
next_version_idx = history_content.find("\n### Aider v", version_idx + len(version_header))
if next_version_idx == -1:
# No next version found, use the rest of the file
relevant_history = history_content[start_idx:]
else:
# Extract just up to the next version
relevant_history = history_content[start_idx:next_version_idx]
# Save relevant portions to temporary files
with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".diff") as tmp_diff: