def refresh_all_counts(self, all=None):
        if all:
            with Aggregate.index_executor(GitObject, 'repository_ids'):
                for repo in Repository.all():
                    count = repo.count_objects()
                    repo.set_count(count)
                    logger.info('Setting count for %s to %d' % (repo, count))
                    repo.save()

        with Aggregate.index_executor(Repository, 'been_indexed'):
            count = self.indexed_repository_count = Repository.find({'been_indexed' : True}).count()
            logger.info('Looks like there are %d indexed repositories' % count)
        self.save()
        flush()

        with Aggregate.index_executor(GitObject, 'type'):
            self.blob_count = Blob.find({}).count()
            self.tree_count = Tree.find({}).count()
            self.commit_count = Commit.find({}).count()
            self.tag_count = Tag.find({}).count()
            logger.info('Also, there are %d blobs, %d trees, %d commits, and %d tags' %
                        (self.blob_count, self.tree_count, self.commit_count, self.tag_count))
        self.save()
        flush()
dataset/ETHPy150Open ebroder/anygit/anygit/backends/mongodb.py/Aggregate.refresh_all_counts/original