Commit graph

21 commits

Author SHA1 Message Date
Mislav Marohnić
c232c8872c Abort pr checkout when PR has an invalid head branch name 2020-07-15 16:16:38 +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ć
446a4111f7 Respect hostnames when resolving git remotes and URL args to repos 2020-07-02 20:36:10 +02:00
Mislav Marohnić
e4448c73e4 Respect original hostname in formatRemoteURL() 2020-06-23 20:06:50 +02:00
Corey Johnson
4c75c8bccc Reset base branch when URL is used 2020-06-03 14:34:13 -07:00
Corey Johnson
15770881bb Use an array 2020-05-27 10:08:29 -07:00
Corey Johnson
e341d7b49f Fix test 2020-05-27 08:38:30 -07:00
Corey Johnson
8d1f2745a4 wip 2020-05-26 16:35:35 -07:00
vilmibm
c8c807b954 pass apiClient to determineBaseRepo
Our code had an unspoken assumption that only one apiClient is created
during the course of a command. Violating this assumption is fine in
almost all cases, but not when we need to do a re-auth to add a new
oauth scope to a user's token.

There is likely a more elegant solution to the problem but until then
this changes determineBaseRepo to use an existing apiClient.
2020-05-15 15:29:33 -05:00
vilmibm
bec58ede98 respect ssh
this adds recognition of the git_protocol setting when:

- creating a repo
- cloning a repo
- forking a repo
- forking/pushing during pr create
- checking out a PR

additionally, it:

- consolidates remote adding to use AddRemote; this introduces a fetch
where there previously hadn't been one
- changes repo clone to accept an ssh url
- changes repo fork to accept an ssh url

i just added basic unit tests; adding new test cases for all of the
above scenarios seemed like diminishing returns.
2020-04-22 14:21:01 -05:00
Tiernan L
806574f9c1
spell out PR
changes "PR" ---> "pull request" for consistency and clarity
2020-04-06 09:56:45 -10:00
vilmibm
44acdd4ec3 Merge branch 'master' into pr-status-no-commits 2020-03-30 12:04:02 -05: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
vilmibm
f4b8851011 Merge remote-tracking branch 'origin/master' into pr-status-no-commits 2020-03-25 12:00:58 -05:00
vilmibm
5187ad4431 move preparecmd and Runnable to its own package 2020-03-23 16:32:29 -05: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
Dasio
19cc79cac8 Removed explicit capacity in slice initialization 2020-02-26 15:44:52 +01:00
Dasio
8aa46c236e Init slice with provided capacity if it's known in advance 2020-02-24 22:16:41 +01:00
vilmibm
c5a511a2d1 Revert "prefix branch names for local pr checkout"
This reverts commit 5b8d7c1841.
2020-02-13 17:16:53 -06:00
vilmibm
5b8d7c1841 prefix branch names for local pr checkout 2020-02-04 17:49:02 -06:00
vilmibm
36397dbdc5 move checkout to its own file 2020-02-04 13:18:29 -06:00