diff --git a/scripts/update-history.py b/scripts/update-history.py index c21867147..36579b64e 100755 --- a/scripts/update-history.py +++ b/scripts/update-history.py @@ -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: