How to use the libmozevent.mercurial.Repository function in libmozevent

To help you get started, we’ve selected a few libmozevent examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla / code-review / events / code_review_events / workflow.py View on Github external
def get_repositories(self, repositories, cache_root, default_ssh_key=None):
        """
        Configure repositories, and index them by phid
        """

        def _build_conf(config):
            # Use the default ssh key when specific repo key is not available
            if config.get("ssh_key") is None:
                config["ssh_key"] = default_ssh_key
            assert config["ssh_key"] is not None, "Missing ssh key"
            return config

        repositories = {
            phab_repo["phid"]: Repository(_build_conf(conf), cache_root)
            for phab_repo in self.api.list_repositories()
            for conf in repositories
            if phab_repo["fields"]["name"] == conf["name"]
        }
        assert len(repositories) > 0, "No repositories configured"
        logger.info(
            "Configured repositories", names=[r.name for r in repositories.values()]
        )
        return repositories