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

37 Коммитов

Автор SHA1 Сообщение Дата
Mislav Marohnić 00b846af46 Backport cukes from 1.12-stable branch 2014-12-24 20:20:28 -08:00
Jingwen Owen Ou 356173d4a4 Back port cukes from v1.12.3
v2.2.0 doesn’t have the bug bc4b450b61 but back porting the cukes in case there’ll be regression for v2.2.0.
2014-12-24 09:02:18 -08:00
Jingwen Owen Ou 3aeba67bad Treat remote URL user name case insensitive when creating PR
See https://github.com/github/hub/issues/685
2014-11-16 12:58:56 -08:00
Mislav Marohnić 44aefe7728 Fix git commit summary in pull request message template
Use "origin/<base>" and "origin/<head>" for git commit comparison and
summary in the pull request template instead of the local branch
equivalents, since the local branches could be out of date with the
remote tracking branches.
2014-10-19 23:41:45 +02:00
Mislav Marohnić a070963dff Use "text/template" instead of "html/" to not have HTML-escaping
Otherwise, characters like quotes, less/greater than signs, and
ampersand would get HTML-escaped in the text editor for the pull request
message.
2014-07-29 22:22:27 -07:00
Mislav Marohnić 5539949491 Merge remote-tracking branch 'origin/master' into cukes-master 2014-07-27 14:18:13 -07:00
Mislav Marohnić 2200d93788 Port remaining `pull-request` tests to cukes 2014-07-27 13:54:46 -07:00
Jingwen Owen Ou 6da9c51d7c Remove unused scenarios 2014-07-15 15:44:48 -07:00
Jingwen Owen Ou 04677d39f4 Merge remote-tracking branch 'origin/master' into merge_master
Conflicts:
	features/pull_request.feature
2014-06-09 07:38:09 -07:00
Mislav Marohnić 8a8ee07d4a Don't re-wrap default pull request message taken from commit
Re-wrapping to 78 chars was dangerous since it could lead to moving
a #-reference to the beginning of a line which would then get
interpreted as a comment.

Wrapping pull request message is not useful anyway since it's Markdown.
For best results when rendered, users should unwrap their text.

Fixes #548, closes #570
2014-05-18 22:07:44 +07:00
Mislav Marohnić 1570fec324 Respect git "core.commentchar" setting
The comment char is read from git config if it exists, but defaults to
"#" as before.

Fixes #530
2014-05-18 12:46:41 +07:00
Mislav Marohnić ea0103fbc5 Fix "invalid byte sequence" errors in `pull-request`
If the user's `LANG` environment variable doesn't include "UTF-8", the
default external encoding in Ruby will be US-ASCII and as such, string
operations will fail dealing with pull request message or changelog that
contains non-ASCII characters.

This explicitly configures external encoding in hub to default to "UTF-8".
This applies to data over ARGV, `$stdin.read`, and reading files.

Fixes #566
2014-05-17 23:22:17 +07:00
Jingwen Owen Ou c49dd3f52f Exit with error if command-line flag parsing fails 2014-04-15 15:56:53 +02:00
Mislav Marohnić 24add1e38a Merge remote-tracking branch 'origin/master' into master-to-gh 2014-04-11 18:05:59 +02:00
Jingwen Owen Ou 40c9b52146 Remove test for older version of hub 2014-03-02 11:54:52 -08:00
Mislav Marohnić 6558a9fdfd Avoid mispelled `pull-request` flags getting misinterpreted as title
If someone misspells `--help`, for instance:

    git pull-request -help

This aborts the command instead of continuing by interpreting `-help` as
it was the deprecated title argument. Any value that starts with a dash
will abort.

Fixes #460
2014-03-01 00:32:55 +01:00
Tomas Varneckas ea741028e7 Add option to open pull request in browser. 2014-02-27 11:36:32 +02:00
Jingwen Owen Ou 4c363e9703 Remove deprecated scenario for pull request 2014-02-21 10:19:15 -08:00
Ivan Tse efe8c97e46 Improve extracting title & body in `pull-request`
Avoids the issue where leading empty lines would result in an empty
pull request title.

Fixes #439, closes #465
2014-01-19 06:46:36 +01:00
Mislav Marohnić bb73ac1d8f Fix Ruby 1.8 failure with missing stderr in Cucumber test
In cukes, we use Aruba which uses ChildProcess to handle spawning of hub
processes in tests. It uses Tempfile to create file descriptors with
which stdout and stderr streams are collected from the child process.

However, when hub finished with an `exec`, the stderr in one test would
be mysteriously blank in Ruby 1.8. I tracked that down to being an issue
of Ruby not flushing STDERR output to the stream (really a Tempfile in
the context of tests). https://travis-ci.org/github/hub/jobs/15965636

This hopes to fix the tests, but shouldn't change anything about how hub
operates normally when invoked directly.
2013-12-25 23:54:48 +01:00
Mislav Marohnić 06999d907e Improve detecting of origin remote and remote branch
In hub lingo, "origin remote" is the remote pointing to the canonical
GitHub project, i.e. where pull requests should be sent. "Remote branch"
is where hub guesses the user has pushed their changes from the current
local branch.

The origin remote can now be called "upstream", "github", or "origin",
in that order of precedence.

The `browse`, `compare`, and especially `pull-request` commands need to
know the remote branch. Previously we relied on git upstream
configuration, but that wasn't enough. This behavior is now only kept if
git "push.default" is set to "upstream" or "tracking".

For "push.default" values "current", "simple" (git 2.0 default), or
"matching" (git 1.x default), we can safely assume that the user
probably pushes to the same-named branches on some remote, and we ignore
upstream configuration.

To find the remote where the user pushed their changes, we search for
the same-named branch on:

1. the remote which points to a GitHub project owned by the current user;
2. "origin", "github", and "upstream" remotes.

When a match is found, it is assumed that the user pushed there and it
is taken as the implicit pull-request head.

Fixes #158, fixes #360, fixes #381
2013-12-22 00:25:28 +01:00
Mislav Marohnić 4f70dd126f Deprecate converting issue to pull-request
This feature is likely to get dropped from GitHub API in the near
future. The alternative is to simply create a new pull-request and
reference the original issue in the description.
2013-12-22 00:22:43 +01:00
Mislav Marohnić 5e130ac0c7 Remove duplicate cukes 2013-12-22 00:16:51 +01:00
Mislav Marohnić eedc53b4bf add test for opening pull requests on Enterprise host
references #407
2013-09-28 19:27:20 +02:00
Mislav Marohnić e645f9aaed pull-request: detect default branch for project
This is usually "master" but for e.g. git-flow projects it's "develop".
GitHub has an API field for the default branch but I avoided having to
hit the API and instead read from the "head" of the origin remote.

  git rev-parse --symbolic-full-name origin
  #=> refs/remotes/origin/develop

The "head" of the remote seems to be set at clone time by default, and
can be manually set with:

  git remote set-head origin develop

The pull-request command now detects this and sets the default branch as
the pull request base instead of always assuming "master" at origin.

Fixes #154, closes #326
2013-07-16 23:35:37 +02:00
Mislav Marohnić 0a1b13eb4f don't reuse outdated pull request messages
Prior to a53f028, hub didn't clean up PULLREQ_EDITMSG files after a successful
pull request. When people upgrade to the new version of hub which reuses PR
messages, these leftover files will get reused when opening new PRs and will
lead to confusion. The hackish solution is to ignore PULLREQ_EDITMSG files that
are older than the hub ruby script on disk.
2013-06-26 02:42:51 +02:00
Mislav Marohnić 42f51eb774 sabotage any git operation in tests that opens the text editor
This is a guard against enountering any potentially blocking commands
2013-05-25 21:32:30 +02:00
Mislav Marohnić fae048bbfb port more pull-request tests to cukes 2013-05-13 22:44:22 +02:00
Mislav Marohnić 99c51069fa simplify assertion of supplied API params 2013-05-12 21:11:42 +02:00
Mislav Marohnić 37accd47d9 enable passing in `pull-request` title & body
Emulates the interface of `git commit`:

  $ hub pull-request -m "This is my title"
  $ hub pull-request -F /path/to/message.txt
  $ hub pull-request -F -

The old way of passing in just title is deprecated

  $ hub pull-request "Deprecated title"

Fixes #183
2013-05-12 21:11:42 +02:00
Mislav Marohnić a53f02893a improve preserving message from failed pull request
- If text editor aborts, message is discarded.
 - If the API request to create the PR fails, message is kept.
 - If the API request succeeds, message is discarded.
 - When kept message is reused for subsequent PR, only its title and
   body get inserted. The PR instructions and changelog still get
   regenerated.

Fixes #178
2013-05-11 21:04:05 +02:00
Mislav Marohnić 9104102016 Add Hub version string to User-Agent and test 2013-04-25 13:03:02 +02:00
Luismi Cavalle 70a62f8ade friendly error for `pull-request` in detached HEAD 2013-03-24 18:14:36 +01:00
Mislav Marohnić da38826b2c pull-request: helpful err msg when base project is 404
Fixes #288
2013-02-08 00:54:17 +01:00
Mislav Marohnić 66ab0d75c0 fix `pull-request` with Unicode chars on Ruby 1.8
The problem was that the dumb JSON generator simply dumped strings with
Ruby's `inspect` method, which on 1.8 generates escape sequences that
are incompatible with JSON.

Now strings are dumped simply as they are, with only a handful
characters escaped (double quote, backslash, whitespace).

Fixes #235
2012-11-06 14:16:07 +01:00
Mislav Marohnić e007c41632 add encoding directive to API POST payloads
References #235
2012-11-05 20:40:10 +01:00
Mislav Marohnić 595b53c3ce read remotes URLs with `remote -v` instead of git-config
When reading config, "insteadOf" substitution rules aren't applied.
Using `git remote -v` is better because it reports the URLs that would
actually be used by git.

This reverts the feature that supports detecting the GitHub URL among
multiple others made for #59. If you have multiple URLs configured for
the same remote, put the GitHub one first and you'll be fine.

Fixes #241
2012-10-10 13:59:45 +02:00