add exception of parent_id

This commit is contained in:
zhangxunhui 2022-09-04 12:55:54 +08:00
parent 328b82c840
commit d28f4cd845
2 changed files with 5 additions and 4 deletions

View File

@ -1,4 +1,4 @@
[settings]
line_length = 79
multi_line_output = 3
known_third_party =apscheduler,dulwich,numpy,pandas,pymysql,sqlalchemy,yaml
known_third_party =dulwich,numpy,pandas,pymysql,sqlalchemy,yaml

View File

@ -72,10 +72,11 @@ class RiskEvaluator(object):
for relation in commit_relation_results:
commit_id = relation["id"]
parent_id = relation["parent_id"]
commit_children_dict.setdefault(parent_id, [])
commit_children_dict[parent_id].append(commit_id)
commit_parents_dict.setdefault(commit_id, [])
commit_parents_dict[commit_id].append(parent_id)
if parent_id is not None:
commit_parents_dict[commit_id].append(parent_id)
commit_children_dict.setdefault(parent_id, [])
commit_children_dict[parent_id].append(commit_id)
# if the clone pair only live in one commit, this commit belongs to both start commit and end commit
if len(candidate_commits) == 1: