mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 09:14:59 +00:00
feat: Modify script to consider files at specific tag or commit
This commit is contained in:
parent
49e5530d3b
commit
1b39b18772
1 changed files with 12 additions and 8 deletions
|
@ -17,10 +17,10 @@ def blame(start_tag, end_tag=None):
|
||||||
|
|
||||||
authors = get_commit_authors(commits)
|
authors = get_commit_authors(commits)
|
||||||
|
|
||||||
pats = "*.py *.scm *.sh **Dockerfile **Gemfile .github/workflows/*.yml".split()
|
revision = end_tag if end_tag else "HEAD"
|
||||||
files = []
|
files = run(["git", "ls-tree", "-r", "--name-only", revision]).strip().split("\n")
|
||||||
for pat in pats:
|
files = [f for f in files if f.endswith(('.py', '.scm', '.sh', 'Dockerfile', 'Gemfile')) or
|
||||||
files += run(["git", "ls-files", pat]).strip().split("\n")
|
(f.startswith('.github/workflows/') and f.endswith('.yml'))]
|
||||||
|
|
||||||
all_file_counts = {}
|
all_file_counts = {}
|
||||||
grand_total = defaultdict(int)
|
grand_total = defaultdict(int)
|
||||||
|
@ -186,10 +186,14 @@ def get_counts_for_file(start_tag, end_tag, authors, fname):
|
||||||
line_counts[author] += 1
|
line_counts[author] += 1
|
||||||
|
|
||||||
return dict(line_counts)
|
return dict(line_counts)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError as e:
|
||||||
# print(f"Warning: Unable to blame file {fname}. It may have been added after {start_tag} "
|
if "no such path" in str(e).lower():
|
||||||
# f"or removed before {end_tag or 'HEAD'}.", file=sys.stderr)
|
# File doesn't exist in this revision range, which is okay
|
||||||
return None
|
return None
|
||||||
|
else:
|
||||||
|
# Some other error occurred
|
||||||
|
print(f"Warning: Unable to blame file {fname}. Error: {e}", file=sys.stderr)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_all_tags_since(start_tag):
|
def get_all_tags_since(start_tag):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue