mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 16:25:00 +00:00
Implemented a function to get all commit hashes since a specified tag and added a function to get the commit authors.
This commit is contained in:
parent
d5de256796
commit
e8a5af089f
1 changed files with 26 additions and 12 deletions
|
@ -7,34 +7,48 @@ import argparse
|
|||
from pathlib import Path
|
||||
from aider.dump import dump
|
||||
|
||||
|
||||
def get_all_commit_hashes_since_tag(tag):
|
||||
res = run(["git", "rev-list", f"{tag}..HEAD"])
|
||||
|
||||
if res:
|
||||
commit_hashes = res.strip().split('\n')
|
||||
return commit_hashes
|
||||
|
||||
def run(cmd):
|
||||
try:
|
||||
# Get all commit hashes since the specified tag
|
||||
result = subprocess.run(
|
||||
["git", "rev-list", f"{tag}..HEAD"],
|
||||
cmd,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=True
|
||||
)
|
||||
# Split the output into individual commit hashes
|
||||
commit_hashes = result.stdout.strip().split('\n')
|
||||
return commit_hashes
|
||||
return result.stdout
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Error: {e}", file=sys.stderr)
|
||||
return []
|
||||
return
|
||||
|
||||
def get_commit_authors(commits):
|
||||
commit_to_author = dict()
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Get commit hashes since a specified tag.")
|
||||
parser.add_argument("tag", help="The tag to start from")
|
||||
args = parser.parse_args()
|
||||
|
||||
commit_hashes = get_all_commit_hashes_since_tag(args.tag)
|
||||
if commit_hashes:
|
||||
print("Commit hashes since tag", args.tag)
|
||||
for hash in commit_hashes:
|
||||
print(hash)
|
||||
else:
|
||||
print("No commit hashes found or an error occurred.")
|
||||
commits = get_all_commit_hashes_since_tag(args.tag)
|
||||
commits = [commit[:len('44e6fefc2')] for commit in commits]
|
||||
dump(commits)
|
||||
|
||||
authors = get_commit_authors(commits)
|
||||
|
||||
|
||||
#text = run(['git', 'blame', f'{args.tag}..HEAD', '--', 'aider/main.py'])
|
||||
#text = text.splitlines()
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue