default-reviewers: diff data should load more things lazy for better performance.

This commit is contained in:
Marcin Kuzminski 2020-10-06 14:32:24 +02:00
parent 6c71e979b5
commit d724630710

View file

@ -154,9 +154,10 @@ def get_diff_info(
commits = []
if get_commit_authors:
log.debug('Obtaining commit authors from set of commits')
commits = target_scm.compare(
target_ref, source_ref, source_scm, merge=True,
pre_load=["author"])
pre_load=["author", "date", "message", "branch", "parents"])
for commit in commits:
user = User.get_from_cs_author(commit.author)
@ -165,6 +166,7 @@ def get_diff_info(
# lines
if get_authors:
log.debug('Calculating authors of changed files')
target_commit = source_repo.get_commit(ancestor_id)
for fname, lines in changed_lines.items():
@ -190,6 +192,8 @@ def get_diff_info(
author_counts[author] = author_counts.get(author, 0) + 1
email_counts[email] = email_counts.get(email, 0) + 1
log.debug('Default reviewers processing finished')
return {
'commits': commits,
'files': all_files_changes,