api: exposed modified added/modified/deleted functions of commit to return only paths.

This combined with full text search build for certain repositories that each commit
contains lots of file changes results in *huge* (10x in some cases) performance gain.
This commit is contained in:
Marcin Kuzminski 2020-03-16 15:09:45 +01:00
parent 8189b1607f
commit bd9e5dc1c3
4 changed files with 51 additions and 21 deletions

View file

@ -355,12 +355,12 @@ def get_pull_request_or_error(pullrequestid):
def build_commit_data(commit, detail_level):
parsed_diff = []
if detail_level == 'extended':
for f in commit.added:
parsed_diff.append(_get_commit_dict(filename=f.path, op='A'))
for f in commit.changed:
parsed_diff.append(_get_commit_dict(filename=f.path, op='M'))
for f in commit.removed:
parsed_diff.append(_get_commit_dict(filename=f.path, op='D'))
for f_path in commit.added_paths:
parsed_diff.append(_get_commit_dict(filename=f_path, op='A'))
for f_path in commit.changed_paths:
parsed_diff.append(_get_commit_dict(filename=f_path, op='M'))
for f_path in commit.removed_paths:
parsed_diff.append(_get_commit_dict(filename=f_path, op='D'))
elif detail_level == 'full':
from rhodecode.lib.diffs import DiffProcessor