Bug 1858177 - fix regex for renames in filter_git_changes.py r=dbaker DONTBUILD

When filtering renames, our regex wasn't handling git's output (R001),
expecting only the 'R' (a single character, like 'A' for adds, 'D'
for deletes, or 'M' for modifies).  This makes the regex more specific,
and handles the digits.

Differential Revision: https://phabricator.services.mozilla.com/D190589
This commit is contained in:
Michael Froman 2023-10-10 17:47:15 +00:00
Родитель 5f357346e7
Коммит 665cdb4f2b
1 изменённых файлов: 3 добавлений и 1 удалений

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

@ -47,7 +47,9 @@ def filter_git_changes(github_path, commit_sha, diff_filter):
# Convert the directory exclude list to a regex string and filter
# out the excluded directory paths (note the lack of trailing '$'
# in the regex).
regex_excludes = "|".join(["^.\t{}".format(i) for i in exclude_dir_list])
regex_excludes = "|".join(
["^(M|A|D|R\d\d\d)\t{}".format(i) for i in exclude_dir_list]
)
files_not_excluded = [
path for path in changed_files if not re.findall(regex_excludes, path)
]