mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 12:16:31 +00:00
Add v0.1.3 changelog (#143)
* new: 0.1.3发行日志 * 新增输出指定时间范围内的贡献者名单的脚本 * 更新bootloader文档 * update: 简介文档 * new: 镜像站文档 * update: 功能特性文档
This commit is contained in:
47
tools/list_contributors.py
Normal file
47
tools/list_contributors.py
Normal file
@ -0,0 +1,47 @@
|
||||
# pip install gitpython
|
||||
import argparse
|
||||
import sys
|
||||
from git import Repo
|
||||
import os
|
||||
import json
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description='List contributors of DragonOS project')
|
||||
parser.add_argument('--since', type=str, help='Since date')
|
||||
parser.add_argument('--until', type=str, help='Until date')
|
||||
parser.add_argument('--mode', type=str, help='脚本的运行模式 可选:<all> 输出所有信息\n' +
|
||||
' <short> 输出贡献者名单、邮箱以及提交数量', default='all')
|
||||
args = parser.parse_args()
|
||||
|
||||
repo = Repo(os.path.dirname(os.path.realpath(__file__)) + "/..")
|
||||
|
||||
# Get the list of contributors
|
||||
|
||||
format = '--pretty={"commit":"%h", "author":"%an", "email":"%ae", "date":"%cd"}'
|
||||
|
||||
logs = repo.git.log(format, since=args.since, until=args.until)
|
||||
|
||||
|
||||
if args.mode == 'all':
|
||||
print(logs)
|
||||
elif args.mode == 'short':
|
||||
logs = logs.splitlines()
|
||||
print("指定时间范围内总共有", len(logs), "次提交")
|
||||
logs = [json.loads(line) for line in logs]
|
||||
print("贡献者名单:")
|
||||
|
||||
authors = dict()
|
||||
for line in logs:
|
||||
if line['email'] not in authors.keys():
|
||||
authors[line['email']] = {
|
||||
'author': line['author'],
|
||||
'email': line['email'],
|
||||
'count': 1
|
||||
}
|
||||
else:
|
||||
authors[line['email']]['count'] += 1
|
||||
|
||||
# 排序输出
|
||||
authors = sorted(authors.values(), key=lambda x: x['count'], reverse=True)
|
||||
for author in authors:
|
||||
print(author['author'], author['email'], author['count'])
|
Reference in New Issue
Block a user