mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-21 21:04:59 +00:00
refactor: Separate git log and diff in update-history script
This commit is contained in:
parent
292908288b
commit
d9c5ce15f3
1 changed files with 24 additions and 4 deletions
|
@ -24,7 +24,6 @@ def run_git_log():
|
||||||
cmd = [
|
cmd = [
|
||||||
"git",
|
"git",
|
||||||
"log",
|
"log",
|
||||||
"-p",
|
|
||||||
"--pretty=full",
|
"--pretty=full",
|
||||||
f"v{latest_ver}..HEAD",
|
f"v{latest_ver}..HEAD",
|
||||||
"--",
|
"--",
|
||||||
|
@ -36,10 +35,26 @@ def run_git_log():
|
||||||
result = subprocess.run(cmd, capture_output=True, text=True)
|
result = subprocess.run(cmd, capture_output=True, text=True)
|
||||||
return result.stdout
|
return result.stdout
|
||||||
|
|
||||||
|
def run_git_diff():
|
||||||
|
latest_ver = get_latest_version_from_history()
|
||||||
|
cmd = [
|
||||||
|
"git",
|
||||||
|
"diff",
|
||||||
|
f"v{latest_ver}..HEAD",
|
||||||
|
"--",
|
||||||
|
"aider/",
|
||||||
|
":!aider/website/",
|
||||||
|
":!scripts/",
|
||||||
|
":!HISTORY.md",
|
||||||
|
]
|
||||||
|
result = subprocess.run(cmd, capture_output=True, text=True)
|
||||||
|
return result.stdout
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Get the git log output
|
# Get the git log and diff output
|
||||||
diff_content = run_git_log()
|
log_content = run_git_log()
|
||||||
|
diff_content = run_git_diff()
|
||||||
|
|
||||||
# Extract relevant portion of HISTORY.md
|
# Extract relevant portion of HISTORY.md
|
||||||
latest_ver = get_latest_version_from_history()
|
latest_ver = get_latest_version_from_history()
|
||||||
|
@ -67,6 +82,10 @@ def main():
|
||||||
relevant_history = history_content[start_idx:next_version_idx]
|
relevant_history = history_content[start_idx:next_version_idx]
|
||||||
|
|
||||||
# Save relevant portions to temporary files
|
# Save relevant portions to temporary files
|
||||||
|
with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".log") as tmp_log:
|
||||||
|
tmp_log.write(log_content)
|
||||||
|
log_path = tmp_log.name
|
||||||
|
|
||||||
with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".diff") as tmp_diff:
|
with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".diff") as tmp_diff:
|
||||||
tmp_diff.write(diff_content)
|
tmp_diff.write(diff_content)
|
||||||
diff_path = tmp_diff.name
|
diff_path = tmp_diff.name
|
||||||
|
@ -82,7 +101,7 @@ def main():
|
||||||
# Construct and run the aider command
|
# Construct and run the aider command
|
||||||
message = history_prompt.format(aider_line=aider_line)
|
message = history_prompt.format(aider_line=aider_line)
|
||||||
|
|
||||||
cmd = ["aider", hist_path, "--read", diff_path, "--msg", message, "--no-git", "--no-auto-lint"]
|
cmd = ["aider", hist_path, "--read", log_path, diff_path, "--msg", message, "--no-git", "--no-auto-lint"]
|
||||||
subprocess.run(cmd)
|
subprocess.run(cmd)
|
||||||
|
|
||||||
# Read back the updated history
|
# Read back the updated history
|
||||||
|
@ -109,6 +128,7 @@ def main():
|
||||||
subprocess.run(["scripts/update-docs.sh"])
|
subprocess.run(["scripts/update-docs.sh"])
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
|
os.unlink(log_path)
|
||||||
os.unlink(diff_path)
|
os.unlink(diff_path)
|
||||||
os.unlink(hist_path)
|
os.unlink(hist_path)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue