Example #1
0
    def _parse_watchers_file(self, watch_list):
        all_error_tree = prefix_tree.FilePathTree()
        blame_only_tree = prefix_tree.FilePathTree()

        for watch in watch_list.watches:
            tree = all_error_tree if watch.watch_all_errors else blame_only_tree
            if watch.filepath not in tree:
                tree[watch.filepath] = list()
            tree[watch.filepath].append(watch.email)

        # Set all_error_tree to have accumulator that will allow us to find everyone who was watching
        # the file or a parent of the file
        all_error_tree.set_accumulator(
            accumulator_intializer=list(),
            accumulator_func=lambda x, y: x + y if y else x,
        )

        return all_error_tree, blame_only_tree
Example #2
0
    def _parse_watchers_file(self, filename):
        all_error_tree = prefix_tree.FilePathTree()
        blame_only_tree = prefix_tree.FilePathTree()

        for watch in self._read_json_file(filename):
            tree = all_error_tree if watch.get(
                "watch_all_errors") else blame_only_tree
            if watch["filepath"] not in tree:
                tree[watch["filepath"]] = list()
            tree[watch["filepath"]].append(watch["email"])

        # Set all_error_tree to have accumulator that will allow us to find everyone who was watching
        # the file or a parent of the file
        all_error_tree.set_accumulator(
            accumulator_intializer=list(),
            accumulator_func=lambda x, y: x + y if y else x,
        )

        return all_error_tree, blame_only_tree
Example #3
0
    def _parse_disownership(self, disownership_list):
        disownership_tree = prefix_tree.FilePathTree()
        for entry in disownership_list.disownerships:
            if entry.filepath not in disownership_tree:
                disownership_tree[entry.filepath] = list()
            disownership_tree[entry.filepath].append(entry)

        # Set disownership_tree to have accumulator that will allow us to find everyone who has disowned
        # the file or a parent of the file
        disownership_tree.set_accumulator(
            accumulator_intializer=list(),
            accumulator_func=lambda x, y: x + y if y else x,
        )
        return disownership_tree