Commit graph

514 commits

Author SHA1 Message Date
Mislav Marohnić
da2116f8ee Merge remote-tracking branch 'origin/master' into pr-create-push-default 2020-03-30 13:32:37 +02:00
Mislav Marohnić
04324191fe
Merge pull request #704 from cli/branch-push-detection
Avoid auto-forking/pushing an already pushed branch in `pr create`
2020-03-30 13:28:49 +02:00
Mislav Marohnić
265db26b78 Merge remote-tracking branch 'origin/master' into detect-existing-fork 2020-03-30 12:02:33 +02:00
Mislav Marohnić
965f2704f3 repo fork: reuse existing git remote
Avoid adding a new git remote for a fork if an existing remote is found
that points to the exact forked repo.
2020-03-27 13:30:25 +01:00
Mislav Marohnić
0f98d56649 Rename underscored variable to camelcase 2020-03-27 13:30:25 +01:00
Mislav Marohnić
a6335396cf repo fork: simplify printing the name of an existing forked repo 2020-03-27 13:30:25 +01:00
Mislav Marohnić
cba8331d55 Avoid auto-forking/pushing an already pushed branch in pr create
A branch is considered already pushed if its HEAD commit hash matches
the commit hash of one of the remote tracking branches:
`refs/remotes/<remote>/<branch>`

This mechanism allows the user to:

- Choose a remote as push target for their branch different than the one
  that would automatically get chosen for them by `pr create`;

- Avoid a `git push` operation (and its associated git hooks) if a push
  was not necessary in the first place.
2020-03-26 20:35:42 +01:00
Mislav Marohnić
c36b84e550 Convert git.VerifyRef into a more versatile ShowRefs
This is so we can pass a list of full qualified refs and have them
resolved for both existence and their commit hashes.
2020-03-26 19:21:40 +01:00
Mislav Marohnić
beb0a6a322
Merge pull request #683 from cli/pr-status-unicode
Add unicode to pr status
2020-03-26 13:30:26 +01:00
Nate Smith
e4b8ae0ec4
Merge pull request #665 from cli/preview-default
switch {pr,issue} view default
2020-03-25 11:32:46 -05:00
Nate Smith
26022bc684
Merge pull request #690 from cli/repo-view-terminal
Add ability to view repo in terminal and do it by default
2020-03-25 11:32:26 -05:00
vilmibm
a8a57595dc explicitly ignore readme fetching error 2020-03-25 11:26:58 -05:00
Mislav Marohnić
88cbcc9ec5 Merge remote-tracking branch 'origin/master' into pr-status-unicode 2020-03-25 09:06:27 +01:00
Mislav Marohnić
11327030e7 Tweak whitespace printing in pr status 2020-03-25 09:05:51 +01:00
Mislav Marohnić
5726376ab1 Guard against faulty affiliations GraphQL filter
This API was just fixed in github.com, but it will take a while for the
change to propagate to GitHub Enterprise installs, so guard ourselves
from false positives when querying forks.
2020-03-25 08:26:06 +01:00
Mislav Marohnić
5b2e1847b7 Merge remote-tracking branch 'origin/master' into pr-create-push-default 2020-03-25 08:16:04 +01:00
Amanda Pinsker
7c73cf88ae
Remove formatting from Fprint
Co-Authored-By: Mislav Marohnić <mislav@github.com>
2020-03-24 15:01:21 -07:00
vilmibm
379ecdab54 move readme fetching to api package 2020-03-24 15:21:18 -05:00
Nate Smith
f2e5269158
Merge pull request #694 from cli/respect-b
respect -B when checking for existing pull requests
2020-03-24 15:14:28 -05:00
Nate Smith
537842f64f
Merge pull request #687 from cli/pr-checkout-repo-override
Respect base repository when passing URL argument to `pr checkout/view`
2020-03-24 14:31:38 -05:00
vilmibm
2895252e3b respect -B when checking for existing pull requests 2020-03-23 14:26:31 -05:00
vilmibm
3459dfab95 add viewing repo in terminal 2020-03-20 16:26:49 -05:00
vilmibm
ff96f48479 add ExpectLines helper 2020-03-20 16:26:49 -05:00
Mislav Marohnić
488b47bded Enable tests to capture spinner output
Explicitly assign the writer stream for the progress spinner so that
tests may override it.

The default when not in testing stays the same: the output stream is the
colorable stdout.
2020-03-20 18:18:27 +01:00
Mislav Marohnić
88c060c610 Fix broken pr view test 2020-03-20 18:15:09 +01:00
Mislav Marohnić
9786498a25 Respect base repository when passing URL argument to pr checkout/view
Previously, the repository owner+name component of the URL was ignored
and only the pull request number was read. Now, the URL dictates which
base repository will be used.
2020-03-20 18:06:40 +01:00
Mislav Marohnić
e3653672a8 Simplify git.AddRemote implementation
The 2nd argument now unused since we've determined that, in practice, we
can safely fetch git objects from a freshly created fork on GitHub and
that we don't need the remote URL-swapping workaround.
2020-03-20 13:08:33 +01:00
Amanda Pinsker
57942fcaf8 Add unicode for merge states back in 2020-03-19 13:30:35 -07:00
Amanda Pinsker
fe7def13d3 Update tests 2020-03-19 13:16:07 -07:00
Amanda Pinsker
be7ffe3099 Tweak unicode some more 2020-03-19 13:16:00 -07:00
Amanda Pinsker
ef17aa520d Add unicode to pr status 2020-03-19 10:33:34 -07:00
Mislav Marohnić
d75faab85a Creating a PR now always prioritizes an existing fork as a push target
Before: the default push target for the current branch in `pr create`
was the first repository found among git remotes that has write access.

Now: the default push target is the fork the base repo, if said fork
exists and has write access, falling back to old behavior otherwise.

This change in the default is to facilitate contributions to projects
that have a hard requirement that all pull requests (even those opened
by people with write access to that project) come from forks.
2020-03-19 16:04:23 +01:00
Nate Smith
51eb2cb345
Merge branch 'master' into pr-count 2020-03-18 09:26:05 -07:00
Nate Smith
3334bdd9b7
Merge pull request #668 from cli/mislav/check-if-pr-exists
Check for existing pull request on `pr create`
2020-03-18 08:37:28 -07:00
Nate Smith
75ebf1694f
Merge pull request #670 from cli/pr-status-branch-err
Allow `pr status` in cases where there is no current git branch
2020-03-18 08:34:41 -07:00
Mislav Marohnić
206844681b
Merge pull request #669 from doi-t/add-pr-status-tests
Add unit tests for Closed and Merged states of the current branch
2020-03-18 14:21:42 +01:00
Mislav Marohnić
a40fb04fc3 Allow pr status use when on detached HEAD 2020-03-18 14:14:45 +01:00
Mislav Marohnić
bec667964c Allow pr status -R <repo> usage from outside of a git repo 2020-03-18 14:13:17 +01:00
Mislav Marohnić
e80c2f852d
Merge pull request #656 from sh7dm/fix-repo-not-found
Don't list remotes when --repo flag is set
2020-03-18 13:53:57 +01:00
Toshiya Doi
a2d3923d21 Add unit tests for Closed and Merged states of the current branch 2020-03-18 21:35:06 +09:00
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
Mislav Marohnić
cb06812d19
Merge pull request #532 from mingrammer/consistent-printing
fix: inconsistent format between issue list and status
2020-03-18 11:59:17 +01:00
vilmibm
e4b43b08b9 update usage text 2020-03-17 17:13:48 -05:00
vilmibm
00de6b9c09 switch defaults for issue view 2020-03-17 17:06:42 -05:00
vilmibm
c30b482bf0 switch defaults for pr view 2020-03-17 17:06:42 -05: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
Dmitry Sharshakov
d755288cdf Implement review comments 2020-03-17 20:05:53 +03:00
vilmibm
af46fcb1ff --fill for pr create 2020-03-16 15:32:47 -05:00