def load_repo(self): if hasattr(self, 'repo'): return self.repo_id = self.rest.match['repo_id'] try: self.repo = config.repo(self.repo_id) except git.errors.NoSuchPathError: raise errors.InvalidRepoError(repo_id=self.repo_id)
def get_member(self, repo_id): if repo_id not in self.rest._repos.keys(): # XXX how should we propagate errors? self.rest.status('404 Repo not found') return { 'id': 'not found', 'description': 'doesnt exist' } repo = config.repo(repo_id) repo_dict = { 'id': repo_id, 'description': repo.description, 'branches': [ b.name for b in repo.branches ], 'tree': [ item[0] for item in repo.tree().items() ] } return repo_dict