def mercurial(self, path=None, is_repo_path=False): if VCS_MERCURIAL in self.clients: mercurial = self.clients[VCS_MERCURIAL] if path: if is_repo_path: mercurial.set_repository(path) else: repo_path = mercurial.find_repository_path(path) mercurial.set_repository(repo_path) return mercurial else: try: from rabbitvcs.vcs.mercurial import Mercurial mercurial = Mercurial() if path: if is_repo_path: mercurial.set_repository(path) else: repo_path = mercurial.find_repository_path(path) mercurial.set_repository(repo_path) self.clients[VCS_MERCURIAL] = mercurial return self.clients[VCS_MERCURIAL] except Exception as e: logger.debug("Unable to load Mercurial module: %s" % e) logger.exception(e) self.clients[VCS_MERCURIAL] = self.dummy() return self.clients[VCS_MERCURIAL]
def mercurial(self, path=None, is_repo_path=False): if settings.get("HideItem", "hg"): return self.dummy() if VCS_MERCURIAL in self.clients: mercurial = self.clients[VCS_MERCURIAL] if path: if is_repo_path: mercurial.set_repository(path) else: repo_path = mercurial.find_repository_path(path) mercurial.set_repository(repo_path) return mercurial else: try: from rabbitvcs.vcs.mercurial import Mercurial mercurial = Mercurial() if path: if is_repo_path: mercurial.set_repository(path) else: repo_path = mercurial.find_repository_path(path) mercurial.set_repository(repo_path) self.clients[VCS_MERCURIAL] = mercurial return self.clients[VCS_MERCURIAL] except Exception as e: logger.debug("Unable to load Mercurial module: %s" % e) logger.exception(e) self.clients[VCS_MERCURIAL] = self.dummy() return self.clients[VCS_MERCURIAL]