Bug 1410969 - Return dict from find_paths_and_tags(); r=ahal

This will make the return value more easily extensible and will help
consumers know what the data structures represent.

MozReview-Commit-ID: DaeYsqfMW37

--HG--
extra : rebase_source : 440d16f0604b21f0ec885e1bca5066c32b18f641
This commit is contained in:
Gregory Szorc 2017-10-23 10:36:38 -07:00
Родитель 5c70c4e281
Коммит 9a4d779385
2 изменённых файлов: 13 добавлений и 8 удалений

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

@ -256,15 +256,14 @@ class Test(MachCommandBase):
if not what: if not what:
from tryselect.selectors.syntax import AutoTry from tryselect.selectors.syntax import AutoTry
at = AutoTry(self.topsrcdir, resolver, self._mach_context) at = AutoTry(self.topsrcdir, resolver, self._mach_context)
changed_files, changed_tags = at.find_paths_and_tags( res = at.find_paths_and_tags(False, detect_paths=True)
False, detect_paths=True) if res['paths']:
if changed_files:
print("Tests will be run based on modifications to the " print("Tests will be run based on modifications to the "
"following files:\n\t%s" % "\n\t".join(changed_files)) "following files:\n\t%s" % "\n\t".join(res['paths']))
# TODO this code is redundant with what `find_paths_and_tags` does. # TODO this code is redundant with what `find_paths_and_tags` does.
reader = self.mozbuild_reader(config_mode='empty') reader = self.mozbuild_reader(config_mode='empty')
files_info = reader.files_info(changed_files) files_info = reader.files_info(res['paths'])
paths, tags, flavors = set(), set(), set() paths, tags, flavors = set(), set(), set()
for info in files_info.values(): for info in files_info.values():

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

@ -487,7 +487,11 @@ class AutoTry(object):
if tags: if tags:
print("Pushing tests based on the following tags:\n\t%s" % print("Pushing tests based on the following tags:\n\t%s" %
"\n\t".join(tags)) "\n\t".join(tags))
return paths, tags
return {
'paths': paths,
'tags': tags,
}
def normalise_list(self, items, allow_subitems=False): def normalise_list(self, items, allow_subitems=False):
rv = defaultdict(list) rv = defaultdict(list)
@ -585,8 +589,10 @@ class AutoTry(object):
kwargs[key] = defaults[key] kwargs[key] = defaults[key]
if not any(kwargs[item] for item in ("paths", "tests", "tags")): if not any(kwargs[item] for item in ("paths", "tests", "tags")):
kwargs["paths"], kwargs["tags"] = self.find_paths_and_tags(kwargs["verbose"], res = self.find_paths_and_tags(kwargs['verbose'],
kwargs["detect_paths"]) kwargs['detect_paths'])
kwargs['paths'] = res['paths']
kwargs['tags'] = res['tags']
builds, platforms, tests, talos, jobs, paths, tags, extra = self.validate_args(**kwargs) builds, platforms, tests, talos, jobs, paths, tags, extra = self.validate_args(**kwargs)