-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
37 lines (33 loc) · 1.37 KB
/
test.py
File metadata and controls
37 lines (33 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from git_utils import RepoAnalyze,FilteringOptions,RepoFilter,Commit
import os
if __name__ == '__main__':
# 指定程序的运行目录
os.chdir(r'C:\envirment\code\adhd\code\virbox-dog-adapter')
# 确保当前在 Git 仓库中
if not os.path.exists(".git"):
raise RuntimeError("Not a Git repository")
# 执行过滤
argv = ['--analyze']
args = FilteringOptions.parse_args(argv)
def commit_callback(commit: Commit,meta):
commit_id = commit.original_id.decode()[:7]
author_name = commit.author_name.decode()
author_email = commit.author_email.decode()
commit_message = commit.message.decode()
type = commit.type
date = commit.author_date.decode()
commiter_date = commit.committer_date.decode()
commiter_email = commit.committer_email.decode()
commiter_name = commit.committer_name.decode()
print(f"commit_id: {commit_id}")
print(f"author_name: {author_name}")
print(f"author_email: {author_email}")
print(f"commit_message: {commit_message}")
print(f"type: {type}")
print(f"date: {date}")
print(f"commiter_date: {commiter_date}")
print(f"commiter_email: {commiter_email}")
print(f"commiter_name: {commiter_name}")
print('*'*50)
repo = RepoFilter(args, commit_callback = commit_callback)
repo.run()