Bug 1418883: Look in comm-central repository for changed files. draft
authorTom Prince <mozilla@hocat.ca>
Sun, 19 Nov 2017 21:26:54 -0700
changeset 703782 a3fc6b86e9b0eebd78b5567423eeac49c68ea8f3
parent 703662 cad9c9573579698c223b4b6cb53ca723cd930ad2
child 703791 6a84665a5d9a0ccdc5603094e674406a880ca191
push id90968
push userbmo:mozilla@hocat.ca
push dateMon, 27 Nov 2017 19:05:58 +0000
bugs1418883
milestone59.0a1
Bug 1418883: Look in comm-central repository for changed files. MozReview-Commit-ID: 1p2e7Zbqwtw
taskcluster/taskgraph/files_changed.py
--- a/taskcluster/taskgraph/files_changed.py
+++ b/taskcluster/taskgraph/files_changed.py
@@ -6,17 +6,17 @@
 Support for optimizing tasks based on the set of files that have changed.
 """
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import logging
 import requests
 from redo import retry
-from mozpack.path import match as mozpackmatch
+from mozpack.path import match as mozpackmatch, join as join_path
 
 logger = logging.getLogger(__name__)
 _cache = {}
 
 
 def get_changed_files(repository, revision):
     """
     Get the set of files changed in the push headed by the given revision.
@@ -52,14 +52,27 @@ def check(params, file_patterns):
     revision = params.get('head_rev')
     if not repository or not revision:
         logger.warning("Missing `head_repository` or `head_rev` parameters; "
                        "assuming all files have changed")
         return True
 
     changed_files = get_changed_files(repository, revision)
 
+    if 'comm_repository' in params:
+        repository = params.get('comm_head_repository')
+        revision = params.get('comm_head_rev')
+        if not revision:
+            logger.warning("Missing `comm_head_rev` parameters; "
+                           "assuming all files have changed")
+            return True
+
+        changed_files |= {
+            join_path("comm", file) for file in
+            get_changed_files(repository, revision)
+        }
+
     for pattern in file_patterns:
         for path in changed_files:
             if mozpackmatch(path, pattern):
                 return True
 
     return False