From f222739b0d3576ca8bd9f297c8ed19a5c9857dba Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Sat, 30 Nov 2024 14:01:21 -0800 Subject: [PATCH] fix: preserve older entries when updating HISTORY.md --- scripts/update-history.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/update-history.py b/scripts/update-history.py index c7a0d6512..df9773324 100755 --- a/scripts/update-history.py +++ b/scripts/update-history.py @@ -94,8 +94,17 @@ Also, add this as the last bullet under the "### main branch" section: with open(hist_path, "r") as f: updated_history = f.read() - # Splice the updated portion back into the full history - full_history = history_content[:start_idx] + updated_history + # Find where the next version section would start + if next_version_idx == -1: + # No next version found, use the rest of the file + full_history = history_content[:start_idx] + updated_history + else: + # Splice the updated portion back in between the unchanged parts + full_history = ( + history_content[:start_idx] + # Keep unchanged header + updated_history + # Add updated portion + history_content[next_version_idx:] # Keep older entries + ) # Write back the full history with open("HISTORY.md", "w") as f: