Beispiel #1
0
    def expand_checks(self, checks):
        next_checks = []
        for check in prepare_checks(checks, None, next_checks):
            yield check

        for line in input():
            for check in self.expand_checks_to_input(next_checks, line):
                yield check
Beispiel #2
0
    def expand_checks_to_commit(self, checks, commit):
        next_checks = []
        for check in prepare_checks(checks, commit, next_checks):
            yield check

        for changed_file in commit.get_changed_files():
            for check in self.expand_checks_to_file(next_checks, changed_file):
                yield check
Beispiel #3
0
    def expand_checks_to_commit_list(self, checks, commit_list):
        next_checks = []
        for check in prepare_checks(checks, commit_list, next_checks):
            yield check

        for commit in commit_list:
            if commit.commit_id not in self.checked_commit_ids:
                for check in self.expand_checks_to_commit(next_checks, commit):
                    yield check
                self.checked_commit_ids.add(commit.commit_id)
Beispiel #4
0
    def expand_checks_to_file(self, checks, changed_file):
        # We first need to wait for the previous checks on the same file
        # to finish.  If one of them failed already, we don't bother checking
        # the same file again.  The committer should return back to her
        # commit she broke the file.  It makes too much noise to complain
        # about the same file on multiple commits.
        previous_checks = self.changed_file_checks.setdefault(
            changed_file.path, []
        )
        for check in previous_checks:
            assert check.state >= CheckState.CLONED
            # Wait for the check to run
            while check.state < CheckState.DONE:
                yield None
            if check.state >= CheckState.FAILED:
                return

        for check in prepare_checks(checks, changed_file):
            yield check
            previous_checks.append(check)