Bug 1639406 - for `code-review` generate the propper patch when dealing with `clang-format` issues. r=marco

Differential Revision: https://phabricator.services.mozilla.com/D78060
This commit is contained in:
Andi-Bogdan Postelnicu 2020-06-04 08:53:02 +00:00
Родитель 4362998da5
Коммит affacf5510
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -2309,8 +2309,14 @@ class StaticAnalysis(MachCommandBase):
# Replace the temp path by the path relative to the repository to
# display a valid patch
relative_path = os.path.relpath(original_path, self.topsrcdir)
patch = e.output.replace(target_file, relative_path)
patch = patch.replace(original_path, relative_path)
# We must modify the paths in order to be compatible with the
# `diff` format.
original_path_diff = os.path.join("a", relative_path)
target_path_diff = os.path.join("b", relative_path)
patch = e.output.replace("+++ {}".format(target_file),
"+++ {}".format(target_path_diff)).replace(
"-- {}".format(original_path),
"-- {}".format(original_path_diff))
patches[original_path] = patch
if output_format == 'json':