Exemple #1
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
Exemple #2
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
Exemple #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)
Exemple #4
0
def expand_checks_to_commit_list(checks, commit_list, checked_commit_ids):
    next_checks = []
    for check in prepare_checks(checks, commit_list, next_checks):
        yield check

    changed_file_checks = {}
    for commit in commit_list:
        if commit.commit_id not in checked_commit_ids:
            for check in expand_checks_to_commit(next_checks, commit,
                                                 changed_file_checks):
                yield check
            checked_commit_ids.add(commit.commit_id)
Exemple #5
0
    def expand_checks_to_file(self, checks, changed_file):
        for check in self.changed_file_checks[changed_file.path]:
            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
            self.changed_file_checks[changed_file.path].append(check)
Exemple #6
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)