def get_repo_name(self): """ get the name of the repository :return: the name of the repository """ repo_url = self.repo_operator.get_repo_url(self._repo_dir) repo_name = common.strip_suffix(os.path.basename(repo_url), ".git") return repo_name
def get_prs(manifest): PRs = {} for repo in manifest.repositories: if "under-test" in repo and repo["under-test"] == True: pr_id = repo["commit-id"].split('/')[-2] repo_name = common.strip_suffix(os.path.basename(repo["repository"]), ".git") repo_owner = repo["repository"].split('/')[-2] PRs[repo_name] = {"repo_owner": repo_owner, "pull_request_id": pr_id} return PRs
def get_prs(manifest): PRs = {} for repo in manifest.repositories: if "under-test" in repo and repo["under-test"] == True: pr_id = repo["commit-id"].split('/')[-2] repo_name = common.strip_suffix( os.path.basename(repo["repository"]), ".git") repo_owner = repo["repository"].split('/')[-2] PRs[repo_name] = { "repo_owner": repo_owner, "pull_request_id": pr_id } return PRs
def get_repositories_under_test(manifest_file): """ get repositories whose commit-id is something like: origin/pr/111/merge """ manifest = Manifest(manifest_file) repos_under_test = [] for repo in manifest.repositories: if "under-test" in repo: if repo["under-test"] is True: repo_name = common.strip_suffix( os.path.basename(repo["repository"]), ".git") repos_under_test.append(repo_name) return repos_under_test
def get_repo_commit(manifest_file): """ build {repository:commit-id} dictionary, return the dict. """ manifest = Manifest(manifest_file) manifest.validate_manifest() repo_commit_dict = {} for repo in manifest.repositories: repo_name = common.strip_suffix(os.path.basename(repo["repository"]), ".git") commit_id = repo["commit-id"] repo_commit_dict[repo_name] = commit_id print "[DEBUG] manifest repo_commit dict:", repo_commit_dict return repo_commit_dict
def directory_for_repo(self, repo): """ Get the directory of a repository :param repo: a dictionary :return: the directary of repository """ if 'checked-out-directory-name' in repo: repo_directory = repo['checked-out-directory-name'] else: if 'repository' in repo: repo_url = repo['repository'] repo_directory = common.strip_suffix(os.path.basename(repo_url), ".git") else: raise ValueError("no way to find basename") repo_directory = os.path.join(self._builddir, repo_directory) return repo_directory
def get_repo_name(self): repo_url = self.repo_operator.get_repo_url(self._repo_dir) repo_name = common.strip_suffix(os.path.basename(repo_url), ".git") return repo_name