pull-requests: handle case when removing existing files from a repository in versioning diff.

This commit is contained in:
Marcin Kuzminski 2019-12-06 12:30:54 +01:00
parent a727f47925
commit 20af3498fa

View file

@ -970,8 +970,13 @@ class PullRequestModel(BaseModel):
old_hash = old_files.get(new_filename)
if not old_hash:
# file is not present in old diff, means it's added
added_files.append(new_filename)
# file is not present in old diff, we have to figure out from parsed diff
# operation ADD/REMOVE
operations_dict = diff_data['stats']['ops']
if diffs.DEL_FILENODE in operations_dict:
removed_files.append(new_filename)
else:
added_files.append(new_filename)
else:
if new_hash != old_hash:
modified_files.append(new_filename)