Commit graph

127 commits

Author SHA1 Message Date
Mislav Marohnić
fb621d2988 💅 code style 2020-10-28 15:50:59 +01:00
Mislav Marohnić
d09561d03c 💅 simplify sortPullRequestsByState 2020-10-28 15:50:59 +01:00
Mislav Marohnić
2ac68cc534 PullRequestForBranch: fix outdated error message
This method doesn't necessarily search through open pull requests.
2020-10-28 15:50:59 +01:00
Ian Billett
0f61272333 Allow PullRequestForBranch to search in closed pull requests 2020-10-28 15:50:59 +01:00
Mislav Marohnić
93c8fc1e98 Add tests for GraphQL introspection 2020-10-01 16:33:56 +02:00
Mislav Marohnić
0ef2863ede Cache GHE responses for schema queries
This speeds up `pr`-related commands for GHE by caching schema
introspection queries for 24h.
2020-09-30 19:09:15 +02:00
Mislav Marohnić
ff925fb480 Resolve @me to current username on GHE
It looks like GHE v2.20 does not support `@me` in search yet.
2020-09-30 19:05:06 +02:00
Mislav Marohnić
bed9d11f7a Avoid querying statusCheckRollup or reviewDecision on unsupported GHE
We first ask the GHE server for whether it supports these fields.
2020-09-30 19:04:09 +02:00
Mislav Marohnić
f30bc5bc64
Merge pull request #1552 from cli/release-cmd
Add commands for managing GitHub Releases
2020-09-09 18:07:19 +02:00
vilmibm
0c16a6b0b5 fix butchered query 2020-09-09 09:50:10 -05:00
Mislav Marohnić
ad0bbde351 Merge remote-tracking branch 'origin' into release-cmd 2020-09-09 15:27:49 +02:00
Nate Smith
74614b13da
Merge pull request #1627 from giacomoalbe/add-commit-headline-to-pr-merge
Add PR Title to CommitHeadline during merge PR
2020-09-08 17:05:26 -05:00
Mislav Marohnić
d77a8c2e61 Scope pr merge commit headline to only squash method 2020-09-07 22:27:27 +02:00
Giacomo Alberini
cab0e0f43d Add pr Title and number to commitHeadline in merge request 2020-09-04 23:07:51 +02:00
vilmibm
eb132a1ae6 Merge remote-tracking branch 'origin/trunk' into checks 2020-09-03 14:48:32 -05:00
vilmibm
2961c655fb review feedback 2020-09-02 11:33:39 -05:00
Mislav Marohnić
766e4950d9 Be transparent about which part of pr create flow failed
When applying metadata to the new PR such as assignees or reviewers, if
the operation fails, an error message would get printed:

    failed to create pull request: <API error text>

This was misleading, because the PR did get created; it's just that
updating it failed. The new error message is:

    https://github.com/OWNER/REPO/pull/123
    pull request update failed: <API error text>

The PR URL is printed on stdout and the error message is printed on
stderr. In case of any errors, the exit code is still non-zero.
2020-08-31 16:46:22 +02:00
vilmibm
8dd93e1748 gh pr checks
A basic first pass on gh pr checks that shows all check runs for a given
PR's latest commit.
2020-08-28 13:18:59 -05:00
Mislav Marohnić
c4f5d6db58 Preliminary gh release commands 2020-08-19 18:25:02 +02:00
Roy Ling
006426331c Fix gh pr diff with hostname override
Removed hardcoded url prefix in PR diff
2020-08-15 22:03:42 +08:00
Mislav Marohnić
a73584db72 Merge remote-tracking branch 'origin' into pr-commands-isolate 2020-08-04 15:01:30 +02:00
Mislav Marohnić
af68a749f0 Isolate pr diff command 2020-07-29 22:49:50 +02:00
Mislav Marohnić
288d01318b Respect the hostname of current repository in queries 2020-07-23 22:31:08 +02:00
Mislav Marohnić
86eacc3789 Enable unwrapping api.NotFoundError 2020-07-21 13:59:05 +02:00
Mislav Marohnić
305cd290ee Fix pr checkout <owner>:<branch> when it matches the default branch
First, consolidate the functionality between `pr merge` and `pr
checkout` that resolves the default branch name of the base repo. With
an added bonus, the new approach avoids an API request when one isn't
necessary.

Then, ensure that checking out 3rd-party PRs will result in local branch
name such as `<owner>/<branch>` when the head branch of the repository
matches the default branch of the base repository. We already have had
code in place to take care of this, but it only took effect in the `pr
checkout <number>`-style invocation.
2020-07-15 15:35:42 +02:00
Mislav Marohnić
f4c4ce0b0a Add names to GraphQL queries made over shurcooL adapter 2020-07-07 17:53:40 +02:00
Mislav Marohnić
a7806a3e78 Add names to queries made over our homegrown GraphQL adapter 2020-07-07 17:53:40 +02:00
Mislav Marohnić
1ca3d171e6 Tweak HTTP 422 handling when deleting branches 2020-06-30 19:21:39 +02:00
Pavel Borzenkov
3afec6f90a api: gracefully handle already deleted remote refs
If a GitHub repo is configured to automatically delete branches after PR
is merged, `gh pr merge` fails with error like:

failed to delete remote branch: ... (422): 'Reference does not exist'

Gracefully handle such case and don't report the error.

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
2020-06-27 19:10:42 +03:00
Mislav Marohnić
e084a4563f Fix pr checkout OWNER:BRANCH when maintainer can modify
We did not use to request the necessary GraphQL fields to determine
whether the PR in question can be modified by maintainers (i.e. pushed
back to).
2020-06-22 19:36:55 +02:00
Corey Johnson
ee2b38df68
Merge pull request #1020 from cli/pr-lookup-v2
Consistent PR lookup interface
2020-06-04 10:42:55 -07:00
Corey Johnson
4c75c8bccc Reset base branch when URL is used 2020-06-03 14:34:13 -07:00
Mislav Marohnić
d026d6af2d Use githubv4.MarkPullRequestReadyForReviewInput
This is available now that we've bumped githubv4
2020-05-28 15:38:46 +02:00
Corey Johnson
a7e8d6fba8 Make PullRequestDiff take a pr 2020-05-27 10:10:21 -07:00
Corey Johnson
4b03cb112c Update test stubs 2020-05-27 09:21:02 -07:00
Corey Johnson
8d1f2745a4 wip 2020-05-26 16:35:35 -07:00
Corey Johnson
909e177a74 remove mergeable from queries that don't need it 2020-05-26 08:20:43 -07:00
Corey Johnson
9c48e2da14 Delete the branch 2020-05-22 15:25:25 -07:00
Corey Johnson
9c88cd67ee Whoops 2020-05-22 15:21:51 -07:00
Corey Johnson
9113092f5c Delete via api 2020-05-22 15:19:39 -07:00
Corey Johnson
c3c3058b96 Merge remote-tracking branch 'origin/master' into merge-interactive-merge 2020-05-20 08:30:17 -07:00
Nate Smith
45dec1b3e0
Merge pull request #962 from cli/pr-diff
pr diff
2020-05-19 14:11:36 -05:00
Corey Johnson
6666adbdce Deal with merge conflicts 2020-05-19 11:29:00 -07:00
vilmibm
c98b0924dc properly handle REST errors 2020-05-19 11:58:49 -05:00
vilmibm
aaebdfc46f working with gross colorize hack + no pager 2020-05-18 16:49:51 -05:00
Corey Johnson
922b6e06e0 Can be marked ready for review 2020-05-18 12:42:16 -07:00
Corey Johnson
fad9f24f39 Make reopen work 2020-05-18 11:11:13 -07:00
Mislav Marohnić
c225d379a9 Preserve CODEOWNERS reviewers in pr create
When reviewers were requested on a PR, they would apparently
overwrite the current set of reviewers. A fresh PR will already have
reviewers if it was assigned some by CODEOWNERS rules.

The fix is to only ever add additional reviewers and not overwrite the
entire set.
2020-05-13 12:09:59 +02:00
Corey Johnson
ad3a5903b2
Merge pull request #873 from cli/the-merge-dubai
Add support for `gh pr merge`
2020-05-12 10:18:54 -07:00
Corey Johnson
9187efdc92 Merge remote-tracking branch 'origin/master' into merge-interactive-merge 2020-05-12 08:53:09 -07:00