def fork(service, repo): """ Fork selected repository """ a = App() s = a.get_service(service) s.fork(repo)
def update_labels(source_repo, service, source_service, destination): """ Update labels for the selected repository, default to repo in $PWD """ app = App() url = app.guess_remote_url() git_project = app.get_git_project(url) try: repo_labels = git_project.get_labels() except AttributeError: click.echo( f"Project {git_project.__class__.__name__} does not support repository-wide labels.", err=True, ) sys.exit(2) if not repo_labels: print("No labels.") return for repo_for_copy in destination: other_serv = app.get_service(service, repo=repo_for_copy) changes = other_serv.update_labels(labels=repo_labels) click.echo( "{changes} labels of {labels_count} copied to {repo_name}".format( changes=changes, labels_count=len(repo_labels), repo_name=repo_for_copy ) )
def update_labels(source_repo, service, source_service, destination): """ Update labels for the selected repository, default to repo in $PWD """ app = App() if source_repo: serv = app.get_service(source_service, repo=source_repo) else: serv = app.guess_service() repo_labels = serv.list_labels() if not repo_labels: print("No labels.") return for repo_for_copy in destination: other_serv = app.get_service(service, repo=repo_for_copy) changes = other_serv.update_labels(labels=repo_labels) click.echo("{changes} labels of {labels_count} copied to {repo_name}".format( changes=changes, labels_count=len(repo_labels), repo_name=repo_for_copy ))
def list_tags(service, repo): """ List the tags for the selected repository, default to repo in $PWD """ app = App() if repo: serv = app.get_service(service, repo=repo) else: serv = app.guess_service() repo_tags = serv.list_tags() if not repo_tags: print("No tags.") return print(tabulate([ ( tag['name'], tag['url'] ) for tag in repo_tags ], tablefmt="fancy_grid"))
def list_labels(service, repo): """ List the labels for the selected repository, default to repo in $PWD """ app = App() if repo: serv = app.get_service(service, repo=repo) else: serv = app.guess_service() repo_labels = serv.list_labels() if not repo_labels: print("No labels.") return print(tabulate([ ( label.name, label.color, label.description ) for label in repo_labels ], tablefmt="fancy_grid"))
def list_prs(service, repo): """ List pull requests of a selected repository, default to repo in $PWD """ a = App() if repo: s = a.get_service(service, repo=repo) else: s = a.guess_service() prs = s.list_pull_requests() if not prs: print("No open pull requests.") return print(tabulate([ ( "#%s" % pr['id'], pr['title'], "@%s" % pr['author'], pr['url'] ) for pr in prs ], tablefmt="fancy_grid"))