Граф коммитов

60 Коммитов

Автор SHA1 Сообщение Дата
Mislav Marohnić 9170180900 [checkout] Handle case when PR matches the current branch 2019-10-22 17:48:58 +02:00
Mislav Marohnić 5d42f7dbad [checkout] Make it work independently of remote refspec
This fixes:

    fatal: Cannot setup tracking information; starting point 'BRANCH' is not a branch.

if the remote refspec is set up to only fetch specific branches and NOT
like the default `+refs/heads/*:refs/remotes/origin/*`.

I don't understand why would git, after fetching into
`refs/remotes/origin/BRANCH`, complain that `origin/BRANCH` is not a
branch, but there we have it. Setting up upstream tracking manually
works around this problem.
2019-02-24 09:58:51 +01:00
Mislav Marohnić 97127cf9f2 PR checkout: ensure resulting branch is automatically pushable
When checking out a PR, use its head ref for the default branch name so
that `git push` works by default to push commits back to the PR.
2018-06-06 10:24:06 +02:00
Mislav Marohnić 6be9d54fc2 Reuse most logic betwen `checkout` and `pr` commands 2017-04-08 22:17:18 +02:00
Natalie Weizenbaum f93e53798f Code review changes. 2017-02-03 15:54:44 -08:00
Natalie Weizenbaum 93df826636 Set merge configuration on checkout.
When checking out a pull request that doesn't match an existing remote,
this sets the branch's remote and merge configuration fields. If the
pull request is modifiable by the maintainer, it uses the SSH URL to
that you can push to the pull request.
2017-02-02 23:53:44 -08:00
Mislav Marohnić 6a1f1db6bf Fix `checkout` for unavailable fork - again 2016-10-03 20:37:45 +02:00
Mislav Marohnić f3d909bbf5 Merge branch 'checkout-reuse-remote' 2016-10-03 19:37:36 +02:00
Mislav Marohnić ef5676f4d5 Always use explicit `refs/`-prefixed notation in `checkout` 2016-10-03 18:43:10 +02:00
Mislav Marohnić 671759b23a Fix the case of unavailable fork in `checkout`
Fixes #1293
2016-10-03 18:41:11 +02:00
Mislav Marohnić e1ef66ab28 If found, reuse existing git remote for PR head in `checkout`
When there is already a git remote for the head repo of a PR to be
checked out, fetch the corresponding branch from that remote instead of
fetching the special `refs/pull/XY/head` ref.

This sets up a pull/push workflow for branches that the user might have
write access to and wishes to collaborate on.

Fixes #1238
2016-09-12 10:40:51 +02:00
Mislav Marohnić 758dce9072 Fix oudated `checkout` documentation
It no longer creates new git remotes.
2016-09-12 10:39:50 +02:00
Mislav Marohnić 58d332d500 Improve `checkout` in same-repo scenario
In case when the PR's head and base repositories are the same, check out
the new branch in a way that sets up push workflow to the same branch.

    git fetch origin +refs/heads/fixes:refs/remotes/origin/fixes
    git checkout -b fixes --track origin/fixes
2016-08-21 00:00:13 +02:00
Mislav Marohnić a1f79d8876 Improve finding git remote to fetch from in new `checkout`
The remote needs to match the base project from the pull request.
2016-08-20 22:54:32 +02:00
Pascal Corpet 90a3a539fa Drop the tracking of the remote branch even if the remote repo exists. 2016-08-19 16:19:03 +02:00
Pascal Corpet 8ca5aa4260 Update hub checkout not to create any new remotes thus leaving less tracks behind. 2016-08-18 21:12:34 +02:00
huydx 1cf978ba00 Trivial refactoring of checkout command 2016-07-01 11:30:20 +09:00
Mislav Marohnić fc9fbd4c38 Cross-references galore! 2016-01-25 02:50:01 +11:00
Mislav Marohnić 0a45aa8ddc Reformat inline command help and expand usage options 2016-01-25 02:30:46 +11:00
Keenan Brock 5355655711 rename gh command to hub in docs 2016-01-19 13:31:47 -05:00
Mislav Marohnić ab1c0b7a0f Use `--no-tags` for new remotes in `checkout/cherry-pick`
This is so the tags from the automatically-added remote (typically
someone's fork) don't spill in and mix with the current tags.
2015-05-22 00:04:26 +02:00
Akinori MUSHA 7a3a717d87 Use `.Login` instead of `.Name` for generating a remote or branch name.
It is `headRepo.Owner.Login` that holds the unix account name of the
owner, and `headRepo.Owner.Name` is omitted from the embedded owner
information, resulting in the following failure:

```
% hub checkout https://github.com/github/hub/issues/{number}
fatal: '' is not a valid remote name
```
2015-02-26 15:32:07 +09:00
Mislav Marohnić 9ecd84044b Avoid using "label" field when parsing PR response
To obtain the owner/fork-name combo, instead of reading it from "label"
field from the PR response simply read from `Head.Ref` and
`Head.Repo.Owner.Name` instead. This is because label is meant to be
human-readable, isn't well-documented in GitHub API docs and is unclear
when it contains two components (delimited by `:`) and when it contains
only one.
2015-02-23 18:44:36 +13:00
Jingwen Owen Ou 1fd70dcf64 Report error when there're `-b` or `--orphan` flags in checkout pull request 2015-02-20 13:01:07 -08:00
Jingwen Owen Ou 2884da15b2 `Args.InsertParam` resets index to param size if it’s out of bound
`Args.InsertParam` panics about index out of bound if the index is larger than param size. These changes reset the index to param size for such case. This is equivalent to appending new items to the end.

This fixes #812.
2015-02-17 10:04:45 -08:00
Mislav Marohnić c10144b6cd Fix `hub checkout <PULLREQ-URL>` for renamed fork
Start reading the `Head.Repo.Name` property from API payload to
determine the name of the forked repo which might not match the name of
the base repo.
2015-01-20 22:53:01 -08:00
Jingwen Owen Ou a7badc8c84 Validate git dir when getting local repo 2014-04-01 13:40:02 -07:00
Jingwen Owen Ou 42a7ad5141 The head of the repo in a pull request can be nil 2014-03-31 17:00:42 -07:00
Jingwen Owen Ou 526e741edf Don't import log 2014-03-31 15:44:42 -07:00
Jingwen Owen Ou 53a7829747 Minor refactor of checkout 2014-03-31 13:01:05 -07:00
Jingwen Owen Ou 498789a999 Change namespace to github/hub 2014-02-10 08:29:03 -08:00
David Calavera 371ae8b432 Add global commands to the runner.
- Use a hash to lookup for commands.
- Add more tests for the command and runner execution.
2013-12-29 14:18:14 -08:00
Jingwen Owen Ou ba6363328e Pull in cucumber tests from Hub
Since 31a85e519e...master

Some tests are ignored either because they don't make sense or WIP
2013-12-28 01:14:07 -08:00
Jingwen Owen Ou b480db1f7f Detach Project from GitHub 2013-12-17 07:45:48 -08:00
Jingwen Owen Ou e1d8199acb Make checkout compatible with Hub 2013-12-10 22:05:26 -08:00
Jingwen Owen Ou ea1fb4d263 Use the go-octokit fork 2013-12-03 11:52:10 -08:00
Jingwen Owen Ou 1025d4d79f Fix octokit import path 2013-11-07 18:14:13 -08:00
Jingwen Owen Ou 32e57d23ba Change pull request API to use octokit 2013-11-07 11:54:40 -08:00
Jingwen Owen Ou 1219f0efaa Fix bug in parsing pull request response for user and branch 2013-07-29 10:50:28 -07:00
Jingwen Owen Ou 2032d4c05a Extract duplication to hasGitRemote 2013-07-19 22:53:38 -07:00
Jingwen Owen Ou f72c133ba7 Remove utils.Fatal 2013-07-04 16:29:19 -07:00
Jingwen Owen Ou b521fd0dc8 Move methods to utils 2013-07-02 12:08:48 -07:00
Jingwen Owen Ou e3d6319fa5 Rename to Args#Params 2013-07-02 11:56:45 -07:00
Jingwen Owen Ou 13240c7021 Implement merge 2013-07-02 11:28:50 -07:00
Jingwen Owen Ou fea856826e Add long description to checkout and remote 2013-07-01 11:29:08 -07:00
Jingwen Owen Ou 3e21478773 Fix remote not accepting normal args 2013-06-30 09:00:21 -07:00
Jingwen Owen Ou ff5b5ce6d7 Fallthrough to git if no commands match 2013-06-28 16:49:49 -07:00
Jingwen Owen Ou c294d2b615 Use Args for arguments 2013-06-28 16:49:49 -07:00
Jingwen Owen Ou db292bcf5e Clean up git.go 2013-06-24 14:40:05 -07:00
Jingwen Owen Ou 391503fa0f Extract to smaller methods 2013-06-24 14:11:40 -07:00