summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Bradford <david.bradford@mongodb.com>2019-10-01 22:54:41 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-04-03 20:40:48 +0000
commit2d5eec6c235bb41e05f64dd2221474f900681c53 (patch)
treeb48dfadc9c1adf45f2e23cb8cfdd752a3a6ba5bd
parenta0c43c842ae51c433cf187f53312a9fe918fa910 (diff)
downloadmongo-2d5eec6c235bb41e05f64dd2221474f900681c53.tar.gz
SERVER-43732: correctly detect new files for burn_in_tests
(cherry picked from commit 96fe4ec19114546b6b3f369c10d4ebd0aa678530)
-rw-r--r--buildscripts/patch_builds/change_data.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/buildscripts/patch_builds/change_data.py b/buildscripts/patch_builds/change_data.py
index c8e1e321359..d5ddbb9d849 100644
--- a/buildscripts/patch_builds/change_data.py
+++ b/buildscripts/patch_builds/change_data.py
@@ -10,10 +10,26 @@ LOGGER = structlog.get_logger(__name__)
def _paths_for_iter(diff, iter_type):
- return {change.a_path for change in diff.iter_change_type(iter_type)}
+ """
+ Get the set for all the files in the given diff for the specified type.
+
+ :param diff: git diff to query.
+ :param iter_type: Iter type ['M', 'A', 'R', 'D'].
+ :return: set of changed files.
+ """
+ a_path_changes = {change.a_path for change in diff.iter_change_type(iter_type)}
+ b_path_changes = {change.b_path for change in diff.iter_change_type(iter_type)}
+ return a_path_changes.union(b_path_changes)
def _modified_files_for_diff(diff: DiffIndex, log: Any) -> Set:
+ """
+ Get the set of files modified in the given git diff.
+
+ :param diff: Git diff information.
+ :param log: Logger for logging.
+ :return: Set of files that were modified in diff.
+ """
modified_files = _paths_for_iter(diff, 'M')
log.debug("modified files", files=modified_files)
@@ -23,11 +39,10 @@ def _modified_files_for_diff(diff: DiffIndex, log: Any) -> Set:
renamed_files = _paths_for_iter(diff, 'R')
log.debug("renamed files", files=renamed_files)
- # We don't care about delete files, but log them just in case.
deleted_files = _paths_for_iter(diff, 'D')
log.debug("deleted files", files=deleted_files)
- return modified_files.union(added_files).union(renamed_files)
+ return modified_files.union(added_files).union(renamed_files).union(deleted_files)
def find_changed_files(repo: Repo) -> Set[str]: