Пример #1
0
def check(params, file_patterns):
    """Determine whether any of the files changed in the indicated push to
    https://hg.mozilla.org match any of the given file patterns."""
    repository = params.get("head_repository")
    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_head_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
Пример #2
0
def check(params, file_patterns):
    """Determine whether any of the files changed in the indicated push to
    https://hg.mozilla.org match any of the given file patterns."""
    repository = params.get('head_repository')
    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_head_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