Commit graph

9 commits

Author SHA1 Message Date
Mislav Marohnić
9bdc63c4ca Eliminate API overfetching in pr commands
This completely rewrites the PR lookup mechanism so that the caller
must specify the GraphQL fields to query for each PR. Additionally, this
fixes some export problems with `pr view --json`.

Features:

- Each pr command now gets assigned a concept of a Finder. This makes it
  easier to stub the PR in tests without having to stub the underlying
  HTTP calls or git invocations.

- `pr view --web` is much faster since it only fetches the "url" field.

- `pr diff 123` now skips a whole API call where a whole PR was
  unnecessarily preloaded just to access its diff in a subsequent call.

- PullRequestGraphQL query builder is now used to construct queries.

- A bunch of individual commands are now freed of having to know about
  concepts such as BaseRepo, Branch, Config, or Remotes.
2021-04-30 20:34:36 +02:00
Cristian Dominguez
8a0d5b0e43 Add note about current branch detection 2021-04-13 12:30:07 -03:00
Mislav Marohnić
6ad6784c46 Ignore EPIPE when forwarding pr diff output to pager 2020-09-14 15:30:10 +02:00
Mislav Marohnić
d01355e24b Add global PAGER support
Extract the ad-hoc PAGER behavior from `pr diff` command and make it
available opt-in to any command through IOStreams.
2020-09-04 23:07:17 +02:00
Mislav Marohnić
c21caf5b2b Disallow pr -R flag for commands that operate on the current branch
If the `--repo` flag is specified, then the user intends to select a
repository other than the current one. In that case, it doesn't make
sense to fall back to detecting the PR belonging to the current branch,
so throw a descriptive error instead.
2020-08-27 16:30:34 +02:00
Martín Montes
df66a8f131 Using default pager in gh pr diff 2020-08-17 22:31:30 +02:00
Mislav Marohnić
6490d7717c Fix --repo override taking effect for pr commands 2020-08-06 21:39:46 +02:00
Mislav Marohnić
7949d5373d Fix pr diff in notty mode 2020-07-29 22:58:08 +02:00
Mislav Marohnić
af68a749f0 Isolate pr diff command 2020-07-29 22:49:50 +02:00