mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 10:14:59 +00:00
Added support for marking Aider-related lines in the blame output.
This commit is contained in:
parent
0984dd9aae
commit
e6e5330e72
1 changed files with 2 additions and 20 deletions
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
from aider.dump import dump
|
from aider.dump import dump
|
||||||
|
|
||||||
|
@ -21,30 +22,11 @@ def get_aider_commits():
|
||||||
|
|
||||||
return commits
|
return commits
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
def mark_aider_lines(filename):
|
|
||||||
aider_commits = set(get_aider_commits())
|
|
||||||
|
|
||||||
with open(filename, "r") as f:
|
|
||||||
lines = f.readlines()
|
|
||||||
|
|
||||||
for i, line in enumerate(lines, start=1):
|
|
||||||
result = subprocess.run(
|
|
||||||
["git", "blame", "-L", f"{i},{i}", "--porcelain", filename],
|
|
||||||
capture_output=True,
|
|
||||||
text=True,
|
|
||||||
check=True
|
|
||||||
)
|
|
||||||
commit_hash = result.stdout.split(" ")[0]
|
|
||||||
if commit_hash in aider_commits:
|
|
||||||
print(f"* {line}", end="")
|
|
||||||
else:
|
|
||||||
print(f" {line}", end="")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if len(sys.argv) != 2:
|
if len(sys.argv) != 2:
|
||||||
print(f"Usage: {sys.argv[0]} <filename>")
|
print(f"Usage: {sys.argv[0]} <filename>")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
mark_aider_lines(sys.argv[1])
|
mark_aider_lines(sys.argv[1])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue