Commit graph

56 commits

Author SHA1 Message Date
Mislav Marohnić
5b76881624 Improve detecting existing PR on pr create
- Only check for existing PRs if `--web` wasn't given
- Fix detecting PRs from forks
- Improve order of error handling: local validation errors are handled
  earlier than the ones that have to consult the API
2020-03-18 13:09:02 +01:00
Mislav Marohnić
23dfeff84f Merge remote-tracking branch 'origin/master' into check-if-pr-exists 2020-03-18 12:04:08 +01:00
vilmibm
0344e9543a humanize branch name for title 2020-03-17 16:18:32 -05:00
vilmibm
98a2281f45 more nuanced error handling 2020-03-17 16:09:40 -05:00
vilmibm
af46fcb1ff --fill for pr create 2020-03-16 15:32:47 -05:00
vilmibm
2d90c09f48 review feedback 2020-03-16 15:32:35 -05:00
Tarasovych
d0c32e7a3d changed error message and pr check 2020-03-16 16:01:03 +02:00
vilmibm
8769299731 titlebody prepopulation 2020-03-13 15:12:03 -05:00
Tarasovych
f3c9406e76 fixed repo argument 2020-03-13 16:01:37 +02:00
Tarasovych
b544583b26 added check if pr already exists 2020-03-13 14:02:29 +02:00
Mislav Marohnić
d584a9692c Raise error if --draft was used in pr create --web
Since we cannot pass the "draft" option as query parameter, this raises
an error instead of proceeding to open the browser and potentially
confuse the user as to why `--draft` wasn't respected.
2020-03-09 14:53:27 +01:00
Mislav Marohnić
7777307588 Avoid forking/pushing until pr create inputs have been processed
This avoids fork or push operation if there were errors processing the
input arguments or if the operation has been cancelled during
interactive survey.
2020-03-09 14:51:40 +01:00
Mislav Marohnić
c10f2ff945 Communicate to the user that we're waiting before retrying git push
When the user has just created a fork, it might not yet be ready for
writing. This ensures that the wait period between retries is
communicated to the user on stderr.
2020-02-24 19:36:54 +01:00
Mislav Marohnić
1a82e39ba9 Respect title & body from arguments to pr create -w 2020-02-20 22:48:04 +01:00
Mislav Marohnić
96ba2d27d8 Respect overriden base branch in pr create --web 2020-02-17 14:14:37 +01:00
vilmibm
212dc1da1d properly specify head ref for cross-repo/same-branch 2020-02-12 16:11:04 -06:00
vilmibm
22be13d8d5 move resolveRemotesToRepos to context 2020-02-11 19:33:04 -06:00
vilmibm
9025838448 update error text 2020-01-28 10:20:59 -06:00
vilmibm
bfd1d804a8 prevent graphql error 2020-01-27 16:00:11 -06:00
Mislav Marohnić
a710893fc1 Rename to cli/cli 2020-01-24 16:08:52 +01:00
Mislav Marohnić
b44dad2319 Merge remote-tracking branch 'origin/master' into no-errors-wrap 2020-01-23 16:46:56 +01:00
Nate Smith
a0f2e1736a Merge pull request #244 from github/ghrepo-interface
Extract common interface for a GitHub Repository
2020-01-23 09:39:16 -06:00
Nate Smith
bf0f345ea3 Merge pull request #243 from github/display-url
Extract helper for URL display
2020-01-23 09:36:40 -06:00
Mislav Marohnić
9122bc181c Migrate away from errors.Wrap()
Turns out the "standard" way of wrapping errors in Go is via
`fmt.Errorf("%w")`, which doesn't require an external package and also allows a
finer control of error sentence formatting.
2020-01-23 13:19:28 +01:00
Mislav Marohnić
90f6a73ba5 Extract helper to print a URL 2020-01-22 23:03:23 +01:00
Mislav Marohnić
1f90579d2a Extract common interface for a GitHub Repository
Also define a handful of utility methods:
- `New(owner, repo)`
- `FullName`: the name slash owner pair
- `FromFullName`: parse the name slash owner pair
- `FromURL`: parse a GitHub.com URL
- `IsSame(r1, r2)`: compare two repositories
2020-01-22 22:44:46 +01:00
Mislav Marohnić
a767fd7910 Add code comments for tricky parts 2020-01-22 18:37:50 +01:00
Mislav Marohnić
e2a825effb Auto-fork on pr create if no pushable target found 2020-01-22 18:32:06 +01:00
Mislav Marohnić
fa30c16ad5 Fix web-based pr create for forks 2020-01-21 23:20:32 +01:00
Mislav Marohnić
6c49614db7 Fix tests 2020-01-21 22:56:15 +01:00
Mislav Marohnić
7a614ce697 Support triangular git workflows in pr create
- The local git remotes are scanned and resolved to GitHub repositories
- The "base" repo is the first result resolved to its parent repo (if a fork)
- The name of the default branch is read from the base repo
- The "head" repo is the first repo that has push access
2020-01-21 18:26:08 +01:00
vilmibm
31001877bd hide potentially long query strings when printing urls 2020-01-16 14:18:40 -06:00
vilmibm
1e19b9953a use pluralize helper 2020-01-15 12:39:35 -06:00
vilmibm
32461284cc fix some TODOs 2020-01-15 12:35:28 -06:00
vilmibm
7bbd70d6b2 use default to preserve non-interactive behavior 2020-01-15 11:27:25 -06:00
vilmibm
d8cbb6a6a7 support previewing PRs in the browser 2020-01-14 17:03:53 -06:00
vilmibm
e821d2781a towards extending survey.Editor behavior 2020-01-14 15:20:11 -06:00
Corey Johnson
2e0ea153d5 Merge remote-tracking branch 'origin/master' into appropriate-context-and-feedback 2020-01-06 09:52:26 -08:00
Corey Johnson
b98bd2cfb8 Use base branch 2019-12-20 10:58:25 -08:00
Mislav Marohnić
d5ba3de751 Add template support to issue create, pr create
If multiple templates are found, the user is prompted to select one.

The templates are searched for, in order of preference:

- issues:
  1. `.github/ISSUE_TEMPLATE/*.md`
  2. `.github/ISSUE_TEMPLATE.md`
  3. `ISSUE_TEMPLATE/*.md`
  4. `ISSUE_TEMPLATE.md`
  5. `docs/ISSUE_TEMPLATE/*.md`
  6. `docs/ISSUE_TEMPLATE.md`

- pull requests:
  1. `.github/PULL_REQUEST_TEMPLATE/*.md`
  2. `.github/PULL_REQUEST_TEMPLATE.md`
  3. `PULL_REQUEST_TEMPLATE/*.md`
  4. `PULL_REQUEST_TEMPLATE.md`
  5. `docs/PULL_REQUEST_TEMPLATE/*.md`
  6. `docs/PULL_REQUEST_TEMPLATE.md`

The filename matches are case-insensitive.
2019-12-18 22:15:20 +01:00
Mislav Marohnić
7b7c985e79 Merge remote-tracking branch 'origin/master' into appropriate-context-and-feedback 2019-12-17 13:00:10 +01:00
Corey Johnson
6d0f4e7a90 Add more text 2019-12-16 11:41:56 -08:00
Corey Johnson
2b53172ebe Add line for pr create 2019-12-16 10:54:22 -08:00
Mislav Marohnić
48aeff1ca7 Assert stdout separarely from stderr in command tests
This stubs stderr separately from stdout in command tests (before those
streams were combined) and improves test assertions around output.

Additionally, no longer use the `cmd.Print*()` family of Cobra functions
because their name sounds like the text will go to stdout, but they
write to stderr instead. Use the more explicit `cmd.ErrOrStderr()` as
output destination instead.
2019-12-16 15:46:42 +01:00
Mislav Marohnić
e93ab66107 Merge pull request #147 from github/pr-to-pull-request
Consistently use "pull request" instead of "PR" in user-facing copy
2019-12-13 17:14:17 +01:00
Nate Smith
995093591b s/-B/-T 2019-12-11 15:03:23 -06:00
Mislav Marohnić
cc7b2f0ea8 Consistently use "pull request" instead of "PR" in user-facing copy 2019-12-11 09:31:57 +01:00
Mislav Marohnić
5ac4b1e6d6 Implement pr create --web 2019-12-04 16:26:40 +01:00
Mislav Marohnić
5d644d2468 Silence stderr in git push during pr create but show it on failures 2019-12-04 16:16:10 +01:00
vilmibm
633c8c070b factor out title body prompting 2019-11-20 11:39:42 -06:00