mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +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 pathlib import Path
|
||||||
from aider.dump import dump
|
from aider.dump import dump
|
||||||
|
|
||||||
|
|
||||||
def get_all_commit_hashes_since_tag(tag):
|
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:
|
try:
|
||||||
# Get all commit hashes since the specified tag
|
# Get all commit hashes since the specified tag
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
["git", "rev-list", f"{tag}..HEAD"],
|
cmd,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
check=True
|
check=True
|
||||||
)
|
)
|
||||||
# Split the output into individual commit hashes
|
return result.stdout
|
||||||
commit_hashes = result.stdout.strip().split('\n')
|
|
||||||
return commit_hashes
|
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print(f"Error: {e}", file=sys.stderr)
|
print(f"Error: {e}", file=sys.stderr)
|
||||||
return []
|
return
|
||||||
|
|
||||||
|
def get_commit_authors(commits):
|
||||||
|
commit_to_author = dict()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="Get commit hashes since a specified tag.")
|
parser = argparse.ArgumentParser(description="Get commit hashes since a specified tag.")
|
||||||
parser.add_argument("tag", help="The tag to start from")
|
parser.add_argument("tag", help="The tag to start from")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
commit_hashes = get_all_commit_hashes_since_tag(args.tag)
|
commits = get_all_commit_hashes_since_tag(args.tag)
|
||||||
if commit_hashes:
|
commits = [commit[:len('44e6fefc2')] for commit in commits]
|
||||||
print("Commit hashes since tag", args.tag)
|
dump(commits)
|
||||||
for hash in commit_hashes:
|
|
||||||
print(hash)
|
authors = get_commit_authors(commits)
|
||||||
else:
|
|
||||||
print("No commit hashes found or an error occurred.")
|
|
||||||
|
#text = run(['git', 'blame', f'{args.tag}..HEAD', '--', 'aider/main.py'])
|
||||||
|
#text = text.splitlines()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue