提交 aca2de60 编写于 作者: M Mars Liu

sync tree.py script

上级 9c1d6997
...@@ -7,7 +7,6 @@ import sys ...@@ -7,7 +7,6 @@ import sys
import uuid import uuid
import re import re
id_set = set() id_set = set()
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO) logger.setLevel(logging.INFO)
...@@ -17,6 +16,14 @@ handler.setFormatter(formatter) ...@@ -17,6 +16,14 @@ handler.setFormatter(formatter)
logger.addHandler(handler) logger.addHandler(handler)
def search_author(author_dict, username):
for key in author_dict:
names = author_dict[key]
if username in names:
return key
return username
def user_name(md_file, author_dict): def user_name(md_file, author_dict):
ret = subprocess.Popen([ ret = subprocess.Popen([
"git", "log", md_file "git", "log", md_file
...@@ -27,11 +34,11 @@ def user_name(md_file, author_dict): ...@@ -27,11 +34,11 @@ def user_name(md_file, author_dict):
if line.startswith('Author'): if line.startswith('Author'):
author_lines.append(line.split(' ')[1]) author_lines.append(line.split(' ')[1])
author_nick_name = author_lines[-1] author_nick_name = author_lines[-1]
return author_dict.get(author_nick_name, "") return search_author(author_dict, author_nick_name)
def load_json(p): def load_json(p):
with open(p, 'r') as f: with open(p, 'r', encoding="utf-8") as f:
return json.loads(f.read()) return json.loads(f.read())
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册