Skip to content

Commit

Permalink
MINOR: [Archery] Improve crossbow report-pr ergonomics (#13994)
Browse files Browse the repository at this point in the history
* If a pull request with the given title is not found, also print the repo name.
* Allow shorthand "username/reponame" as remote, in addition to full Github URLs.

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
  • Loading branch information
pitrou committed Aug 29, 2022
1 parent 9d86755 commit b8c04c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions dev/archery/archery/crossbow/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ def asset_callback(task_name, task, asset):
@click.option('--arrow-remote', '-r', default=None,
help='Set GitHub remote explicitly, which is going to be cloned '
'on the CI services. Note, that no validation happens '
'locally. Examples: https://github.com/apache/arrow or '
'https://github.com/raulcd/arrow.')
'locally. Examples: "https://github.com/apache/arrow" or '
'"raulcd/arrow".')
@click.option('--crossbow', '-c', default='ursacomputing/crossbow',
help='Crossbow repository on github to use')
@click.option('--fetch/--no-fetch', default=True,
Expand Down
14 changes: 9 additions & 5 deletions dev/archery/archery/crossbow/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,13 @@ def _git_ssh_to_https(url):
def _parse_github_user_repo(remote_url):
m = re.match(r'.*\/([^\/]+)\/([^\/\.]+)(\.git)?$', remote_url)
if m is None:
raise CrossbowError(
"Unable to parse the github owner and repository from the "
"repository's remote url '{}'".format(remote_url)
)
# Perhaps it's simply "username/reponame"?
m = re.match(r'^(\w+)/(\w+)$', remote_url)
if m is None:
raise CrossbowError(
f"Unable to parse the github owner and repository from the "
f"repository's remote url {remote_url!r}"
)
user, repo = m.group(1), m.group(2)
return user, repo

Expand Down Expand Up @@ -557,7 +560,8 @@ def github_pr(self, title, head=None, base="master", body=None,
if title in pull.title:
return pull
raise CrossbowError(
f"Pull request with Title: {title} not found"
f"Pull request with Title: {title!r} not found "
f"in repository {repo.full_name!r}"
)


Expand Down

0 comments on commit b8c04c8

Please sign in to comment.