mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-21 12:55:00 +00:00
fix: preserve older entries when updating HISTORY.md
This commit is contained in:
parent
a280f5d5b2
commit
f222739b0d
1 changed files with 11 additions and 2 deletions
|
@ -94,8 +94,17 @@ Also, add this as the last bullet under the "### main branch" section:
|
||||||
with open(hist_path, "r") as f:
|
with open(hist_path, "r") as f:
|
||||||
updated_history = f.read()
|
updated_history = f.read()
|
||||||
|
|
||||||
# Splice the updated portion back into the full history
|
# Find where the next version section would start
|
||||||
full_history = history_content[:start_idx] + updated_history
|
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
|
# Write back the full history
|
||||||
with open("HISTORY.md", "w") as f:
|
with open("HISTORY.md", "w") as f:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue