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

933 Коммитов

Автор SHA1 Сообщение Дата
Mislav Marohnić de6f95cc07 Merge pull request #1952 from OliverJAsh/patch-1
Docs: mention that comma-separated lists must not have spaces
2019-06-25 18:07:42 +02:00
Mislav Marohnić 9cb62f9ffc [pull-request] Avoid crash when branch is pushed to a non-GitHub remote 2019-06-25 17:35:31 +02:00
Mislav Marohnić b6d9837aa7 [api] Implement GraphQL pagination
The GraphQL query has to accept the optional `endCursor` string variable
and output `pageInfo`:

    pageInfo {
      hasNextPage
      endCursor
    }
2019-06-15 15:54:07 +02:00
Mislav Marohnić 424acfa86f [api] Implement REST pagination 2019-06-15 15:16:16 +02:00
Mislav Marohnić 583488c713 [pull-request] Abort if the current branch doesn't seem published
This is the heuristics we apply to determine if a branch was pushed:

1. The branch has remote tracking information (`branch.<branch>.remote`
   and `branch.<branch>.merge` config) that does NOT point to the
   base branch for this pull request; or

2. There exists a `refs/remotes/*/<branch>` ref in any git remote.

Otherwise, we consider the branch NOT pushed and we abort before
processing the pull-request command further.
2019-06-15 03:10:16 +02:00
Mislav Marohnić 66fce6e4d3 Merge remote-tracking branch 'origin/master' into issue-1930 2019-06-15 01:31:32 +02:00
Mislav Marohnić 45f7d02a7d
Merge pull request #2141 from ashemesh/master
[pr] add ability to open Pull Request in the browser

Closes #1586
2019-06-15 00:41:37 +02:00
Mislav Marohnić 8b49f3c0a7
Merge pull request #2166 from daniel-vera-g/fix-#2155
Add a milestone name instead of an id, when creating
2019-06-15 00:31:59 +02:00
Mislav Marohnić fcdcfffc4a [pr show] Support upstream configuration with no tracking branch
If `hub pr checkout <NUMBER>` was used, the tracking configuration for
the created branch might look like this for forks:

    branch.<branch>.remote https://github.com/<owner>/<repo>.git
    branch.<branch>.merge refs/heads/<branch>

Since `RemoteBranchAndProject()` doesn't handle this case, we can't use
it. I want to avoid expanding its functionality right now since it's
being used in several places and I don't want to risk causing
regressions in other commands. Instead, `pr show` now performs its own
upstream branch lookup.
2019-06-15 00:27:43 +02:00
Mislav Marohnić a7426780ae [pr show] Add ability to open a pull request based on number 2019-06-14 16:32:58 +02:00
Mislav Marohnić 7a62066524 [pr show] Cover scenario where no matching pull request was found 2019-06-14 16:08:13 +02:00
Mislav Marohnić 0a755b3d98 [pr show] Fix implementation for triangular workflow scenario 2019-06-14 16:05:45 +02:00
Mislav Marohnić 8047583ad4 [pull-request] Add `--no-maintainer-edits` flag 2019-06-14 15:00:41 +02:00
Mislav Marohnić e5cc8207cd [issue] Support passing either milestone name or number 2019-06-14 02:46:29 +02:00
danielVg 25f56c7de9
Add a milestone name instead of an id 2019-06-12 18:54:00 +02:00
Florian Thomas ad28ff3146 check head branch exists before creating PR
Previously hub checked that there were
[no unpushed commits](b3b3ebb8e5/commands/pull_request.go (L219-L223))
but this check doesn't work when there is not even a remote branch.

This fixes #1930.
2019-06-09 16:46:03 +01:00
Mislav Marohnić 2c83c152fa [create] Fix newline in error message
Fixes #2162
2019-06-06 23:31:03 +02:00
Daniel Compton 629437c8c9 Move commitLogs declaration inside multiple commits block
This makes it clearer that commits are only added as a commented section
in the case when there are multiple commits on a branch.
2019-06-05 04:54:21 +12:00
Mislav Marohnić d76e3e8ebf pull-request: support detached HEAD if `--head` was passed
Fixes #2146
2019-05-29 22:34:41 +02:00
Assaf Shemesh 9495211932 [pr] add ability to open Pull Request in the browser 2019-05-25 21:55:42 +02:00
Mislav Marohnić 039afea3c6 Only process stdout when shelling out to git
For stderr, either attach it to parent stderr or silence it completely.
This enables GIT_TRACE.
2019-05-08 20:51:49 +02:00
Mislav Marohnić d8973922ac Propagate global git arguments to Before/After chains
This fixes `hub -C mydir merge <URL>` and other commands that might be
invoked with git global arguments by ensuring that those global
arguments are also fowarded to any accompanying `git` commands within
`Before()` and `After()` chains.
2019-04-14 15:08:21 +02:00
Mislav Marohnić accfda9aa4 [remote] Avoid crash in argument parsing
Fixes #2102
2019-04-08 12:11:54 +02:00
Mislav Marohnić d2d203bcad [pull-request] Fix non-draft pull requests
This works around a GitHub API issue where it blocks PRs based on their
draft status even if they were `draft: false`.

Fixes #2099
2019-03-29 12:33:09 +01:00
Mislav Marohnić b99071f118 [pull-request] Tweak & test opening a PR as a draft 2019-03-29 02:02:40 +01:00
Matthieu Antoine b207e80358 Implement opening draft pull requests
Implement draft by adding a -d / --draft argument. Add setting header on
the API client for the moment as the feature is still in preview on the API
2019-03-29 01:18:03 +01:00
Mislav Marohnić e4fe4bae37
Merge pull request #2096 from github/no-command
Fix compatibility with git when run with no arguments
2019-03-29 01:12:18 +01:00
Mislav Marohnić d78097d2b1 [issue] Fix `--format %L` output in no-color mode 2019-03-29 00:28:44 +01:00
Mislav Marohnić 4412eddff1 Fix compatibility with git when run with no arguments
Fixes this error:

    $ hub --git-dir=.git
    git: '' is not a git command. See 'git --help'.

Instead, help text is shown just like with normal git.
2019-03-28 23:55:24 +01:00
Mislav Marohnić dadc26d2e4 Allow repository names that start with a dash character
These are allowed on GitHub.
2019-03-18 12:49:42 +01:00
Mislav Marohnić 08f2844e47 [help] List `api` among custom hub commands
Fixes #2066
2019-03-11 20:37:23 +01: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ć ad6e36233d [release] Clarify that `delete` doesn't remove the git tag
Ref. #2043
2019-02-20 19:05:19 +01:00
Mislav Marohnić d21937391a [pr] New format fields `%pS` and `%pC` for PR state and color
- `%pS`: "open", "draft", "merged", or "closed"
- `%pC`: green, gray, purple, or red
2019-02-18 15:26:06 +01:00
Mislav Marohnić 3625691293 [cli] Have commands with rich output respect the `--color` flag
- default: `--color=auto`
- `--color` is equivalent to `--color=always`
- `--color=never` disables color for TTYs
2019-02-18 14:21:25 +01:00
Mislav Marohnić 57187d17ea Merge branch 'remote_names'
Fixes https://github.com/github/hub/issues/2025
2019-02-13 01:39:16 +01:00
Mislav Marohnić 2d0f786b38 [create] Support `--remote-name <REMOTE>` argument 2019-02-13 01:37:52 +01:00
Mislav Marohnić 3ab153abe6 [create] Simplify checking for invalid first argument 2019-02-13 01:29:08 +01:00
Mislav Marohnić 081810c441 [api] Cache HTTP 4xx server responses (except 403)
Assume that 4xx responses will be the same given the same request, so
these responses should be subject to caching too.

Avoids caching 403 because that is the status returned when GitHub API
limit is hit.

Continue not caching 5xx responses because they indicate server errors,
so it's possible that a 2nd request of identical parameters succeeds.
2019-02-13 00:39:43 +01:00
Paul Gierz e2be7f1960 remote name can be specified in the create command 2019-02-09 13:11:53 +01:00
Mislav Marohnić 9ef7b64b7c [api] Improve documentation 2019-02-07 04:22:59 +01:00
Mislav Marohnić 46165a3771 [api] Allow passing in a raw request body via `--input <FILE>` 2019-02-07 04:00:33 +01:00
Mislav Marohnić df7b30a039 [ci-status] Add support for `--format` string 2019-01-29 21:54:18 +01:00
Mislav Marohnić cadc8d2885 [ci-status] Ensure consistent ordering of results in verbose mode
Statuses are now sorted the same as in the GitHub web interface:

- failing first;
- then pending;
- then success/neutral;
- everything in-between is sorted alphabetically.

Fixes #2021
2019-01-29 21:00:51 +01:00
Mislav Marohnić 7e8672304a [api] Add `-i` flag to output HTTP response headers 2019-01-28 00:36:07 +01:00
Mislav Marohnić d87dc4dfa7 [api] More consistent error output on HTTP failures
- HTTP response is now printed on stdout regardless of HTTP status
- No longer print an extra newline after HTTP response body
- No more `Error: HTTP {STATUS}` message on stderr
- hub exits with status 22 instead of 1
2019-01-27 22:40:31 +01:00
Mislav Marohnić c87b8d8e84 [api] Add flag to set custom HTTP headers 2019-01-27 22:05:29 +01:00
Mislav Marohnić 91ef7a55b3 [api] Tweak fields documentation
[ci skip]
2019-01-26 19:08:30 +01:00
Mislav Marohnić 521a5ade40 [api] Fix case when only `--raw-field` are POSTed 2019-01-26 16:33:11 +01:00
Mislav Marohnić 916906b052 [api] Avoid ever prompting for host; always use 1st one 2019-01-26 15:56:05 +01:00
Mislav Marohnić 581ec09170 [api] Add the ability to pass number, boolean, null JSON types 2019-01-26 15:04:08 +01:00
Mislav Marohnić 23d739dffd [api] Add extended documentation for hub-api(1) 2019-01-24 20:05:26 +01:00
Mislav Marohnić 95592b5701 [api] Improve caching
- sort query string in cache key
- include "Accept", "Authorization" headers in cache key
- allow caching of `/graphql` responses
2019-01-24 20:05:26 +01:00
Mislav Marohnić 0692cee64c [api] Handle non-200 HTTP response 2019-01-24 20:05:26 +01:00
Mislav Marohnić 699e268672 [api] Expand `{owner}`, `{repo}` in graphql queries 2019-01-24 20:05:26 +01:00
Mislav Marohnić a5d360344f [api] Add `--raw-field` that has no special treatment for "@" 2019-01-24 20:05:26 +01:00
Mislav Marohnić 1567d0c495 [api] New `hub api` command 2019-01-24 20:05:26 +01:00
Mislav Marohnić 90523e4da6 Tweak descriptions of several commands 2019-01-21 21:54:34 +01:00
Mislav Marohnić c6ea574542 Merge branch 'args-parser' 2019-01-21 21:41:08 +01:00
Mislav Marohnić f5df7cab9f Passing values for long-form flags is now available without `=` 2019-01-21 21:35:15 +01:00
Mislav Marohnić 99e18c8b3b Docs: avoid saying "project" where we mean "repository"
[ci skip]
2019-01-21 12:50:24 +01:00
Mislav Marohnić fba26b09fa Clarify description and homepage fields for `hub create`
Fixes #2011 [ci skip]
2019-01-21 12:42:49 +01:00
Mislav Marohnić 22fc159d0b Fix `issue create --assign LIST` and documentation 2019-01-18 05:13:19 +01:00
Mislav Marohnić 09710c7745 Remove unused `ogier/pflag` 2019-01-18 04:16:46 +01:00
Mislav Marohnić 3d41d7e91f Raise `UsageError()` on invalid arguments 2019-01-18 04:09:43 +01:00
Mislav Marohnić ee31304ba7 Switch `issue` to new args parser 2019-01-18 04:09:43 +01:00
Mislav Marohnić f06e506ef8 Switch `release` to new args parser 2019-01-18 03:47:50 +01:00
Mislav Marohnić 26d2a1fa4a Fix usage synopsis for nested commands
This is displayed for e.g. flag parsing errors like `hub pr list --foo`
2019-01-18 03:47:50 +01:00
Mislav Marohnić 5aeeb680ab Switch `pr` to new args parser 2019-01-18 03:47:50 +01:00
Mislav Marohnić db76bc5bf5 Switch `create` to new args parser 2019-01-18 03:47:50 +01:00
Mislav Marohnić 33eb313452 Switch `compare` to new args parser 2019-01-18 03:47:48 +01:00
Mislav Marohnić 2ca05c036e Switch `browse` to new args parser 2019-01-18 01:50:29 +01:00
Mislav Marohnić 1e733219a7 Switch `alias`, `ci-status`, `delete`, `fork` to new args parser 2019-01-18 01:50:28 +01:00
Mislav Marohnić f0a1f617a5 Simplify some args preprocessing 2019-01-18 01:50:28 +01:00
Mislav Marohnić 01565e4fff Use ArgsParser for `hub help` 2019-01-18 01:50:28 +01:00
Mislav Marohnić ebcc3897d5 Clear up `hub pull-request --issue` documentation
Passing a URL to `--issue` has never worked. It has to be a number.

Passing a URL like `hub pull-request <ISSUE-URL>` has worked but hasn't
been documented. I do not wish to add it to documentation now, as it may
be dropped in the future.
2019-01-18 01:50:28 +01:00
Mislav Marohnić d0f126f95e Switch pull-request to ArgsParser 2019-01-18 01:50:28 +01:00
Mislav Marohnić c0db6e6f0c Use ArgsParser for commands that don't declare flags via pflag 2019-01-18 01:50:28 +01:00
Mislav Marohnić 8f1b5c7f7f Use ArgsParser for `hub remote add` extension 2019-01-17 02:39:08 +01:00
Mislav Marohnić 8d96d21bbd Simplify transformApplyArgs 2019-01-17 02:39:08 +01:00
Mislav Marohnić 796d1b5ae1 Use ArgsParser for `hub clone` extension 2019-01-17 02:39:08 +01:00
Mislav Marohnić ddf0d82510
Merge pull request #1980 from apjanke/improve-label-contrast-ratios
Improve label contrast ratios
2019-01-08 02:39:29 +01:00
Mislav Marohnić 1c2c69ae44 Simplify picking contrasting label text color
Pick between white and black depending on which one is the first to
satisfy the contrast ratio of 7.0 (or 4.5 as fallback).
2019-01-03 04:40:15 +01:00
Mislav Marohnić fccfb060b2 Print usage help on stdout when `--help` was requested 2019-01-03 02:26:13 +01:00
Mislav Marohnić 8373accbcc Print short usage help when running `hub pr` instead of raw markdown
Fixes #1919
2019-01-03 02:25:07 +01:00
Andrew Janke cd307c4c81 Use uint8 RGB color components 2019-01-02 16:46:52 -05:00
Mislav Marohnić 4f0bb5df67 Respect chosen Enterprise host on `hub init -g`
Fixes #1991
2019-01-02 17:11:29 +01:00
Mislav Marohnić 369e7d298e Tweak `hub help hub-help` formatting 2018-12-29 14:58:42 +01:00
Mislav Marohnić f275d483be Fix formatting in hub-release(1) 2018-12-29 14:33:12 +01:00
Mislav Marohnić 7b76308988 Add "See also" section to hub-issue(1) 2018-12-29 14:33:12 +01:00
Mislav Marohnić cf02dd1118 Switch to new md2roff process in `make man-pages` 2018-12-29 14:33:12 +01:00
Mislav Marohnić 02989309ed Docs formatting issues 2018-12-28 17:54:15 +01:00
Mislav Marohnić 2a748a048d Un-deprecate converting issues to pull requests
5 years ago, in anticipation of an API change, I have made the call to
deprecate issue-to-PR conversion in hub. 4f70dd126f

Issue-to-PR conversion was wonky at those times, poorly understood, and
was generating a lot of support requests to hub's issue tracker that I
didn't want to deal with. In most cases, people tried to convert issues
that they have no rights over and they would get a cryptic validation
error in the API response.

Since then, there was a consistent plea from the hub community to keep
this feature as some teams seem to rely on this for their workflows. I
have consulted with other GitHub employees about the stableness of this
feature, and anecdotal evidence suggests that lately there haven't been
as many problems around this as there have been in the past. Also, the
GitHub API v3 will not be getting breaking changes, so it sounds like
this feature is here to stay.

Fixes #1927
Ref. #532, #410, #1806, #1770, #1628
2018-12-28 07:52:45 +01:00
Mislav Marohnić d51379494b Merge branch 'default-upstream-branch' 2018-12-28 07:22:13 +01:00
Mislav Marohnić 2b73d4faed Document how we scan git remotes and branch tracking information 2018-12-28 07:21:03 +01:00
Andrew Janke de9bf5bbee Improve contrast ratio for label text coloring 2018-12-28 05:55:01 +01:00
Mislav Marohnić ab95e380e6 Merge branch '256color-support'
Closes #1979, fixes #1560
2018-12-28 05:32:54 +01:00
Andrew Janke dede9106c2 256-color terminal support 2018-12-28 05:31:08 +01:00
Mislav Marohnić 858e97c596 Encapsulate `localRepo.RemoteForProject(project)` function 2018-12-28 03:54:14 +01:00
Mislav Marohnić c375d52906 Fix detecting default `pull-request` base branch name
This changes the `MasterBranch()` implementation to consider upstream
remotes that might be named differently than "origin". The new
`DefaultBranch(remote)` function is now the preferred alternative.
2018-12-28 01:59:31 +01:00