зеркало из https://github.com/mislav/hub.git
browse/compare/cherry-pick: compensate for GitHub switch to HTTPS
Changes: - `browse` and `compare` always open HTTPS - the `-p` flag for these commands has no effect anymore - updated `browse` URL for wiki pages - cherry-picking a URL doesn't add a new remote as private
This commit is contained in:
Родитель
5c5fdd611f
Коммит
de3ab4165b
22
README.md
22
README.md
|
@ -191,39 +191,33 @@ Creates a new public github repository and adds the remote `origin` at
|
|||
### git browse
|
||||
|
||||
$ git browse
|
||||
> open http://github.com/CURRENT_REPO
|
||||
> open https://github.com/CURRENT_REPO
|
||||
|
||||
$ git browse -- issues
|
||||
> open http://github.com/CURRENT_REPO/issues
|
||||
> open https://github.com/CURRENT_REPO/issues
|
||||
|
||||
$ git browse schacon/ticgit
|
||||
> open http://github.com/schacon/ticgit
|
||||
|
||||
$ git browse -p schacon/ticgit
|
||||
> open https://github.com/schacon/ticgit
|
||||
|
||||
$ git browse resque
|
||||
> open http://github.com/YOUR_USER/resque
|
||||
> open https://github.com/YOUR_USER/resque
|
||||
|
||||
$ git browse resque network
|
||||
> open http://github.com/YOUR_USER/resque/network
|
||||
|
||||
$ git browse -p resque
|
||||
> open https://github.com:YOUR_USER/resque
|
||||
> open https://github.com/YOUR_USER/resque/network
|
||||
|
||||
### git compare
|
||||
|
||||
$ git compare refactor
|
||||
> open http://github.com/CURRENT_REPO/compare/refactor
|
||||
> open https://github.com/CURRENT_REPO/compare/refactor
|
||||
|
||||
$ git compare 1.0...1.1
|
||||
> open http://github.com/CURRENT_REPO/compare/1.0...1.1
|
||||
> open https://github.com/CURRENT_REPO/compare/1.0...1.1
|
||||
|
||||
$ git compare -u fix
|
||||
> (http://github.com/CURRENT_REPO/compare/fix)
|
||||
> (https://github.com/CURRENT_REPO/compare/fix)
|
||||
|
||||
$ git compare other-user patch
|
||||
> open http://github.com/other-user/REPO/compare/patch
|
||||
> open https://github.com/other-user/REPO/compare/patch
|
||||
|
||||
### git submodule
|
||||
|
||||
|
|
|
@ -190,11 +190,11 @@ module Hub
|
|||
def cherry_pick(args)
|
||||
unless args.include?('-m') or args.include?('--mainline')
|
||||
case ref = args.words.last
|
||||
when %r{^(https?:)//github.com/(.+?)/(.+?)/commit/([a-f0-9]{7,40})}
|
||||
scheme, user, repo, sha = $1, $2, $3, $4
|
||||
when %r{^(?:https?:)//github.com/(.+?)/(.+?)/commit/([a-f0-9]{7,40})}
|
||||
user, repo, sha = $1, $2, $3
|
||||
args[args.index(ref)] = sha
|
||||
when /^(\w+)@([a-f1-9]{7,40})$/
|
||||
scheme, user, repo, sha = nil, $1, nil, $2
|
||||
user, repo, sha = $1, nil, $2
|
||||
args[args.index(ref)] = sha
|
||||
else
|
||||
user = nil
|
||||
|
@ -207,8 +207,7 @@ module Hub
|
|||
elsif remotes.include?(user)
|
||||
args.before ['fetch', user]
|
||||
else
|
||||
secure = scheme == 'https:'
|
||||
remote_url = github_url(:user => user, :repo => repo, :private => secure)
|
||||
remote_url = github_url(:user => user, :repo => repo, :private => false)
|
||||
args.before ['remote', 'add', '-f', user, remote_url]
|
||||
end
|
||||
end
|
||||
|
@ -320,25 +319,19 @@ module Hub
|
|||
end
|
||||
|
||||
# $ hub browse
|
||||
# > open http://github.com/CURRENT_REPO
|
||||
# > open https://github.com/CURRENT_REPO
|
||||
#
|
||||
# $ hub browse -- issues
|
||||
# > open http://github.com/CURRENT_REPO/issues
|
||||
# > open https://github.com/CURRENT_REPO/issues
|
||||
#
|
||||
# $ hub browse pjhyett/github-services
|
||||
# > open http://github.com/pjhyett/github-services
|
||||
#
|
||||
# $ hub browse -p pjhyett/github-fi
|
||||
# > open https://github.com/pjhyett/github-fi
|
||||
# > open https://github.com/pjhyett/github-services
|
||||
#
|
||||
# $ hub browse github-services
|
||||
# > open http://github.com/YOUR_LOGIN/github-services
|
||||
# > open https://github.com/YOUR_LOGIN/github-services
|
||||
#
|
||||
# $ hub browse github-services wiki
|
||||
# > open http://wiki.github.com/YOUR_LOGIN/github-services
|
||||
#
|
||||
# $ hub browse -p github-fi
|
||||
# > open https://github.com/YOUR_LOGIN/github-fi
|
||||
# > open https://github.com/YOUR_LOGIN/github-services/wiki
|
||||
def browse(args)
|
||||
args.shift
|
||||
browse_command(args) do
|
||||
|
@ -361,8 +354,6 @@ module Hub
|
|||
|
||||
# $ hub browse -- wiki
|
||||
case subpage = args.shift
|
||||
when 'wiki'
|
||||
params[:web] = 'wiki'
|
||||
when 'commits'
|
||||
branch = (!dest && tracked_branch) || 'master'
|
||||
params[:web] = "/commits/#{branch}"
|
||||
|
@ -378,15 +369,13 @@ module Hub
|
|||
end
|
||||
|
||||
# $ hub compare 1.0...fix
|
||||
# > open http://github.com/CURRENT_REPO/compare/1.0...fix
|
||||
# > open https://github.com/CURRENT_REPO/compare/1.0...fix
|
||||
# $ hub compare refactor
|
||||
# > open http://github.com/CURRENT_REPO/compare/refactor
|
||||
# > open https://github.com/CURRENT_REPO/compare/refactor
|
||||
# $ hub compare myfork feature
|
||||
# > open http://github.com/myfork/REPO/compare/feature
|
||||
# $ hub compare -p myfork topsecret
|
||||
# > open https://github.com/myfork/REPO/compare/topsecret
|
||||
# > open https://github.com/myfork/REPO/compare/feature
|
||||
# $ hub compare -u 1.0...2.0
|
||||
# prints "http://github.com/CURRENT_REPO/compare/1.0...2.0"
|
||||
# "https://github.com/CURRENT_REPO/compare/1.0...2.0"
|
||||
def compare(args)
|
||||
args.shift
|
||||
browse_command(args) do
|
||||
|
@ -573,11 +562,11 @@ help
|
|||
# and `compare`. Yields a block that returns params for `github_url`.
|
||||
def browse_command(args)
|
||||
url_only = args.delete('-u')
|
||||
secure = args.delete('-p')
|
||||
args.delete('-p')
|
||||
params = yield
|
||||
|
||||
args.executable = url_only ? 'echo' : browser_launcher
|
||||
args.push github_url({:web => true, :private => secure}.update(params))
|
||||
args.push github_url({:web => true, :private => true}.update(params))
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -121,10 +121,7 @@ module Hub
|
|||
repo ||= repo_name
|
||||
secure = options[:private]
|
||||
|
||||
if options[:web] == 'wiki'
|
||||
scheme = secure ? 'https:' : 'http:'
|
||||
'%s//wiki.github.com/%s/%s/' % [scheme, user, repo]
|
||||
elsif options[:web]
|
||||
if options[:web]
|
||||
scheme = secure ? 'https:' : 'http:'
|
||||
path = options[:web] == true ? '' : options[:web].to_s
|
||||
'%s//github.com/%s/%s%s' % [scheme, user, repo, path]
|
||||
|
|
30
man/hub.1
30
man/hub.1
|
@ -40,10 +40,10 @@
|
|||
\fBgit push\fR \fIREMOTE\-1\fR,\fIREMOTE\-2\fR,\.\.\.,\fIREMOTE\-N\fR \fIREF\fR
|
||||
.
|
||||
.br
|
||||
\fBgit browse\fR [\fB\-p\fR] [\fB\-u\fR] [[\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR] [SUBPAGE]
|
||||
\fBgit browse\fR [\fB\-u\fR] [[\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR] [SUBPAGE]
|
||||
.
|
||||
.br
|
||||
\fBgit compare\fR [\fB\-p\fR] [\fB\-u\fR] [\fIUSER\fR] [\fISTART\fR\.\.\.]\fIEND\fR
|
||||
\fBgit compare\fR [\fB\-u\fR] [\fIUSER\fR] [\fISTART\fR\.\.\.]\fIEND\fR
|
||||
.
|
||||
.br
|
||||
\fBgit submodule add\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR
|
||||
|
@ -100,10 +100,10 @@ Sets the url of remote \fIREMOTE\-NAME\fR using the same rules as \fBgit remote
|
|||
\fBgit push\fR \fIREMOTE\-1\fR,\fIREMOTE\-2\fR,\.\.\.,\fIREMOTE\-N\fR \fIREF\fR: Push \fIREF\fR to each of \fIREMOTE\-1\fR through \fIREMOTE\-N\fR by executing multiple \fBgit push\fR commands\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
\fBgit browse\fR [\fB\-p\fR] [\fB\-u\fR] [[\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR] [SUBPAGE]: Open repository\'s GitHub page in the system\'s default web browser using \fBopen(1)\fR or the \fBBROWSER\fR env variable\. Use \fB\-p\fR to open a page with https\. If the repository isn\'t specified, \fBbrowse\fR opens the page of the repository found in the current directory\. If SUBPAGE is specified, the browser will open on the specified subpage: one of "wiki", "commits", "issues" or other (the default is "tree")\.
|
||||
\fBgit browse\fR [\fB\-u\fR] [[\fIUSER\fR\fB/\fR]\fIREPOSITORY\fR] [SUBPAGE]: Open repository\'s GitHub page in the system\'s default web browser using \fBopen(1)\fR or the \fBBROWSER\fR env variable\. If the repository isn\'t specified, \fBbrowse\fR opens the page of the repository found in the current directory\. If SUBPAGE is specified, the browser will open on the specified subpage: one of "wiki", "commits", "issues" or other (the default is "tree")\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
\fBgit compare\fR [\fB\-p\fR] [\fB\-u\fR] [\fIUSER\fR] [\fISTART\fR\.\.\.]\fIEND\fR: Open a GitHub compare view page in the system\'s default web browser\. \fISTART\fR to \fIEND\fR are branch names, tag names, or commit SHA1s specifying the range of history to compare\. If \fISTART\fR is omitted, GitHub will compare against the base branch (the default is "master")\.
|
||||
\fBgit compare\fR [\fB\-u\fR] [\fIUSER\fR] [\fISTART\fR\.\.\.]\fIEND\fR: Open a GitHub compare view page in the system\'s default web browser\. \fISTART\fR to \fIEND\fR are branch names, tag names, or commit SHA1s specifying the range of history to compare\. If \fISTART\fR is omitted, GitHub will compare against the base branch (the default is "master")\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
\fBgit submodule add\fR [\fB\-p\fR] \fIOPTIONS\fR [\fIUSER\fR/]\fIREPOSITORY\fR \fIDIRECTORY\fR:
|
||||
|
@ -301,25 +301,19 @@ $ git push origin,staging,qa bert_timeout
|
|||
.nf
|
||||
|
||||
$ git browse
|
||||
> open http://github\.com/CURRENT_REPO
|
||||
> open https://github\.com/CURRENT_REPO
|
||||
|
||||
$ git browse \-\- issues
|
||||
> open http://github\.com/CURRENT_REPO/issues
|
||||
> open https://github\.com/CURRENT_REPO/issues
|
||||
|
||||
$ git browse schacon/ticgit
|
||||
> open http://github\.com/schacon/ticgit
|
||||
|
||||
$ git browse \-p schacon/ticgit
|
||||
> open https://github\.com/schacon/ticgit
|
||||
|
||||
$ git browse resque
|
||||
> open http://github\.com/YOUR_USER/resque
|
||||
> open https://github\.com/YOUR_USER/resque
|
||||
|
||||
$ git browse resque network
|
||||
> open http://github\.com/YOUR_USER/resque/network
|
||||
|
||||
$ git browse \-p resque
|
||||
> open https://github\.com/YOUR_USER/resque
|
||||
> open https://github\.com/YOUR_USER/resque/network
|
||||
.
|
||||
.fi
|
||||
.
|
||||
|
@ -328,16 +322,16 @@ $ git browse \-p resque
|
|||
.nf
|
||||
|
||||
$ git compare refactor
|
||||
> open http://github\.com/CURRENT_REPO/compare/refactor
|
||||
> open https://github\.com/CURRENT_REPO/compare/refactor
|
||||
|
||||
$ git compare 1\.0\.\.\.1\.1
|
||||
> open http://github\.com/CURRENT_REPO/compare/1\.0\.\.\.1\.1
|
||||
> open https://github\.com/CURRENT_REPO/compare/1\.0\.\.\.1\.1
|
||||
|
||||
$ git compare \-u fix
|
||||
> (http://github\.com/CURRENT_REPO/compare/fix)
|
||||
> (https://github\.com/CURRENT_REPO/compare/fix)
|
||||
|
||||
$ git compare other\-user patch
|
||||
> open http://github\.com/other\-user/REPO/compare/patch
|
||||
> open https://github\.com/other\-user/REPO/compare/patch
|
||||
.
|
||||
.fi
|
||||
.
|
||||
|
|
|
@ -88,8 +88,8 @@
|
|||
<code>git cherry-pick</code> <var>GITHUB-REF</var><br />
|
||||
<code>git am</code> <var>GITHUB-URL</var><br />
|
||||
<code>git push</code> <var>REMOTE-1</var>,<var>REMOTE-2</var>,...,<var>REMOTE-N</var> <var>REF</var><br />
|
||||
<code>git browse</code> [<code>-p</code>] [<code>-u</code>] [[<var>USER</var><code>/</code>]<var>REPOSITORY</var>] [SUBPAGE]<br />
|
||||
<code>git compare</code> [<code>-p</code>] [<code>-u</code>] [<var>USER</var>] [<var>START</var>...]<var>END</var><br />
|
||||
<code>git browse</code> [<code>-u</code>] [[<var>USER</var><code>/</code>]<var>REPOSITORY</var>] [SUBPAGE]<br />
|
||||
<code>git compare</code> [<code>-u</code>] [<var>USER</var>] [<var>START</var>...]<var>END</var><br />
|
||||
<code>git submodule add</code> [<code>-p</code>] <var>OPTIONS</var> [<var>USER</var>/]<var>REPOSITORY</var> <var>DIRECTORY</var><br />
|
||||
<code>git fork</code> [<code>--no-remote</code>]</p>
|
||||
|
||||
|
@ -144,14 +144,14 @@ doesn't add new remotes.</p></li>
|
|||
<li><p><code>git push</code> <var>REMOTE-1</var>,<var>REMOTE-2</var>,...,<var>REMOTE-N</var> <var>REF</var>:
|
||||
Push <var>REF</var> to each of <var>REMOTE-1</var> through <var>REMOTE-N</var> by executing
|
||||
multiple <code>git push</code> commands.</p></li>
|
||||
<li><p><code>git browse</code> [<code>-p</code>] [<code>-u</code>] [[<var>USER</var><code>/</code>]<var>REPOSITORY</var>] [SUBPAGE]:
|
||||
Open repository's GitHub page in the system's default web browser
|
||||
using <code>open(1)</code> or the <code>BROWSER</code> env variable. Use <code>-p</code> to open a
|
||||
page with https. If the repository isn't specified, <code>browse</code> opens
|
||||
the page of the repository found in the current directory. If SUBPAGE
|
||||
is specified, the browser will open on the specified subpage: one of
|
||||
"wiki", "commits", "issues" or other (the default is "tree").</p></li>
|
||||
<li><p><code>git compare</code> [<code>-p</code>] [<code>-u</code>] [<var>USER</var>] [<var>START</var>...]<var>END</var>:
|
||||
<li><p><code>git browse</code> [<code>-u</code>] [[<var>USER</var><code>/</code>]<var>REPOSITORY</var>] [SUBPAGE]:
|
||||
Open repository's GitHub page in the system's default web browser using
|
||||
<code>open(1)</code> or the <code>BROWSER</code> env variable. If the repository isn't
|
||||
specified, <code>browse</code> opens the page of the repository found in the current
|
||||
directory. If SUBPAGE is specified, the browser will open on the specified
|
||||
subpage: one of "wiki", "commits", "issues" or other (the default is
|
||||
"tree").</p></li>
|
||||
<li><p><code>git compare</code> [<code>-u</code>] [<var>USER</var>] [<var>START</var>...]<var>END</var>:
|
||||
Open a GitHub compare view page in the system's default web browser.
|
||||
<var>START</var> to <var>END</var> are branch names, tag names, or commit SHA1s specifying
|
||||
the range of history to compare. If <var>START</var> is omitted, GitHub will
|
||||
|
@ -306,40 +306,34 @@ $ git am --ignore-whitespace https://github.com/davidbalbert/hub/commit/fdb9921
|
|||
<h3 id="git-browse">git browse</h3>
|
||||
|
||||
<pre><code>$ git browse
|
||||
> open http://github.com/CURRENT_REPO
|
||||
> open https://github.com/CURRENT_REPO
|
||||
|
||||
$ git browse -- issues
|
||||
> open http://github.com/CURRENT_REPO/issues
|
||||
> open https://github.com/CURRENT_REPO/issues
|
||||
|
||||
$ git browse schacon/ticgit
|
||||
> open http://github.com/schacon/ticgit
|
||||
|
||||
$ git browse -p schacon/ticgit
|
||||
> open https://github.com/schacon/ticgit
|
||||
|
||||
$ git browse resque
|
||||
> open http://github.com/YOUR_USER/resque
|
||||
> open https://github.com/YOUR_USER/resque
|
||||
|
||||
$ git browse resque network
|
||||
> open http://github.com/YOUR_USER/resque/network
|
||||
|
||||
$ git browse -p resque
|
||||
> open https://github.com/YOUR_USER/resque
|
||||
> open https://github.com/YOUR_USER/resque/network
|
||||
</code></pre>
|
||||
|
||||
<h3 id="git-compare">git compare</h3>
|
||||
|
||||
<pre><code>$ git compare refactor
|
||||
> open http://github.com/CURRENT_REPO/compare/refactor
|
||||
> open https://github.com/CURRENT_REPO/compare/refactor
|
||||
|
||||
$ git compare 1.0...1.1
|
||||
> open http://github.com/CURRENT_REPO/compare/1.0...1.1
|
||||
> open https://github.com/CURRENT_REPO/compare/1.0...1.1
|
||||
|
||||
$ git compare -u fix
|
||||
> (http://github.com/CURRENT_REPO/compare/fix)
|
||||
> (https://github.com/CURRENT_REPO/compare/fix)
|
||||
|
||||
$ git compare other-user patch
|
||||
> open http://github.com/other-user/REPO/compare/patch
|
||||
> open https://github.com/other-user/REPO/compare/patch
|
||||
</code></pre>
|
||||
|
||||
<h3 id="git-help">git help</h3>
|
||||
|
|
|
@ -15,8 +15,8 @@ hub(1) -- git + hub = github
|
|||
`git cherry-pick` <GITHUB-REF>
|
||||
`git am` <GITHUB-URL>
|
||||
`git push` <REMOTE-1>,<REMOTE-2>,...,<REMOTE-N> <REF>
|
||||
`git browse` [`-p`] [`-u`] [[<USER>`/`]<REPOSITORY>] [SUBPAGE]
|
||||
`git compare` [`-p`] [`-u`] [<USER>] [<START>...]<END>
|
||||
`git browse` [`-u`] [[<USER>`/`]<REPOSITORY>] [SUBPAGE]
|
||||
`git compare` [`-u`] [<USER>] [<START>...]<END>
|
||||
`git submodule add` [`-p`] <OPTIONS> [<USER>/]<REPOSITORY> <DIRECTORY>
|
||||
`git fork` [`--no-remote`]
|
||||
|
||||
|
@ -80,15 +80,15 @@ alias command displays information on configuring your environment:
|
|||
Push <REF> to each of <REMOTE-1> through <REMOTE-N> by executing
|
||||
multiple `git push` commands.
|
||||
|
||||
* `git browse` [`-p`] [`-u`] [[<USER>`/`]<REPOSITORY>] [SUBPAGE]:
|
||||
Open repository's GitHub page in the system's default web browser
|
||||
using `open(1)` or the `BROWSER` env variable. Use `-p` to open a
|
||||
page with https. If the repository isn't specified, `browse` opens
|
||||
the page of the repository found in the current directory. If SUBPAGE
|
||||
is specified, the browser will open on the specified subpage: one of
|
||||
"wiki", "commits", "issues" or other (the default is "tree").
|
||||
* `git browse` [`-u`] [[<USER>`/`]<REPOSITORY>] [SUBPAGE]:
|
||||
Open repository's GitHub page in the system's default web browser using
|
||||
`open(1)` or the `BROWSER` env variable. If the repository isn't
|
||||
specified, `browse` opens the page of the repository found in the current
|
||||
directory. If SUBPAGE is specified, the browser will open on the specified
|
||||
subpage: one of "wiki", "commits", "issues" or other (the default is
|
||||
"tree").
|
||||
|
||||
* `git compare` [`-p`] [`-u`] [<USER>] [<START>...]<END>:
|
||||
* `git compare` [`-u`] [<USER>] [<START>...]<END>:
|
||||
Open a GitHub compare view page in the system's default web browser.
|
||||
<START> to <END> are branch names, tag names, or commit SHA1s specifying
|
||||
the range of history to compare. If <START> is omitted, GitHub will
|
||||
|
@ -225,39 +225,33 @@ authentication?
|
|||
### git browse
|
||||
|
||||
$ git browse
|
||||
> open http://github.com/CURRENT_REPO
|
||||
> open https://github.com/CURRENT_REPO
|
||||
|
||||
$ git browse -- issues
|
||||
> open http://github.com/CURRENT_REPO/issues
|
||||
> open https://github.com/CURRENT_REPO/issues
|
||||
|
||||
$ git browse schacon/ticgit
|
||||
> open http://github.com/schacon/ticgit
|
||||
|
||||
$ git browse -p schacon/ticgit
|
||||
> open https://github.com/schacon/ticgit
|
||||
|
||||
$ git browse resque
|
||||
> open http://github.com/YOUR_USER/resque
|
||||
> open https://github.com/YOUR_USER/resque
|
||||
|
||||
$ git browse resque network
|
||||
> open http://github.com/YOUR_USER/resque/network
|
||||
|
||||
$ git browse -p resque
|
||||
> open https://github.com/YOUR_USER/resque
|
||||
> open https://github.com/YOUR_USER/resque/network
|
||||
|
||||
### git compare
|
||||
|
||||
$ git compare refactor
|
||||
> open http://github.com/CURRENT_REPO/compare/refactor
|
||||
> open https://github.com/CURRENT_REPO/compare/refactor
|
||||
|
||||
$ git compare 1.0...1.1
|
||||
> open http://github.com/CURRENT_REPO/compare/1.0...1.1
|
||||
> open https://github.com/CURRENT_REPO/compare/1.0...1.1
|
||||
|
||||
$ git compare -u fix
|
||||
> (http://github.com/CURRENT_REPO/compare/fix)
|
||||
> (https://github.com/CURRENT_REPO/compare/fix)
|
||||
|
||||
$ git compare other-user patch
|
||||
> open http://github.com/other-user/REPO/compare/patch
|
||||
> open https://github.com/other-user/REPO/compare/patch
|
||||
|
||||
### git help
|
||||
|
||||
|
|
|
@ -310,15 +310,8 @@ class HubTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_cherry_pick_url_with_remote_add
|
||||
url = 'http://github.com/xoebus/hub/commit/a319d88'
|
||||
assert_commands "git remote add -f xoebus git://github.com/xoebus/hub.git",
|
||||
"git cherry-pick a319d88",
|
||||
"cherry-pick #{url}"
|
||||
end
|
||||
|
||||
def test_cherry_pick_private_url_with_remote_add
|
||||
url = 'https://github.com/xoebus/hub/commit/a319d88'
|
||||
assert_commands "git remote add -f xoebus git@github.com:xoebus/hub.git",
|
||||
assert_commands "git remote add -f xoebus git://github.com/xoebus/hub.git",
|
||||
"git cherry-pick a319d88",
|
||||
"cherry-pick #{url}"
|
||||
end
|
||||
|
@ -560,7 +553,7 @@ config
|
|||
|
||||
def test_hub_compare
|
||||
assert_command "compare refactor",
|
||||
"open http://github.com/defunkt/hub/compare/refactor"
|
||||
"open https://github.com/defunkt/hub/compare/refactor"
|
||||
end
|
||||
|
||||
def test_hub_compare_nothing
|
||||
|
@ -578,89 +571,75 @@ config
|
|||
stub_branch('refs/heads/feature')
|
||||
|
||||
assert_command "compare",
|
||||
"open http://github.com/mislav/hub/compare/experimental"
|
||||
"open https://github.com/mislav/hub/compare/experimental"
|
||||
end
|
||||
|
||||
def test_hub_compare_range
|
||||
assert_command "compare 1.0...fix",
|
||||
"open http://github.com/defunkt/hub/compare/1.0...fix"
|
||||
"open https://github.com/defunkt/hub/compare/1.0...fix"
|
||||
end
|
||||
|
||||
def test_hub_compare_fork
|
||||
assert_command "compare myfork feature",
|
||||
"open http://github.com/myfork/hub/compare/feature"
|
||||
end
|
||||
|
||||
def test_hub_compare_private
|
||||
assert_command "compare -p myfork topsecret",
|
||||
"open https://github.com/myfork/hub/compare/topsecret"
|
||||
"open https://github.com/myfork/hub/compare/feature"
|
||||
end
|
||||
|
||||
def test_hub_compare_url
|
||||
assert_command "compare -u 1.0...1.1",
|
||||
"echo http://github.com/defunkt/hub/compare/1.0...1.1"
|
||||
"echo https://github.com/defunkt/hub/compare/1.0...1.1"
|
||||
end
|
||||
|
||||
def test_hub_browse
|
||||
assert_command "browse mojombo/bert", "open http://github.com/mojombo/bert"
|
||||
assert_command "browse mojombo/bert", "open https://github.com/mojombo/bert"
|
||||
end
|
||||
|
||||
def test_hub_browse_tracking_nothing
|
||||
stub_tracking_nothing
|
||||
assert_command "browse mojombo/bert", "open http://github.com/mojombo/bert"
|
||||
assert_command "browse mojombo/bert", "open https://github.com/mojombo/bert"
|
||||
end
|
||||
|
||||
def test_hub_browse_url
|
||||
assert_command "browse -u mojombo/bert", "echo http://github.com/mojombo/bert"
|
||||
end
|
||||
|
||||
def test_hub_browse_private
|
||||
assert_command "browse -p bmizerany/sinatra",
|
||||
"open https://github.com/bmizerany/sinatra"
|
||||
assert_command "browse -u mojombo/bert", "echo https://github.com/mojombo/bert"
|
||||
end
|
||||
|
||||
def test_hub_browse_self
|
||||
assert_command "browse resque", "open http://github.com/tpw/resque"
|
||||
assert_command "browse resque", "open https://github.com/tpw/resque"
|
||||
end
|
||||
|
||||
def test_hub_browse_subpage
|
||||
assert_command "browse resque commits",
|
||||
"open http://github.com/tpw/resque/commits/master"
|
||||
"open https://github.com/tpw/resque/commits/master"
|
||||
assert_command "browse resque issues",
|
||||
"open http://github.com/tpw/resque/issues"
|
||||
"open https://github.com/tpw/resque/issues"
|
||||
assert_command "browse resque wiki",
|
||||
"open http://wiki.github.com/tpw/resque/"
|
||||
"open https://github.com/tpw/resque/wiki"
|
||||
end
|
||||
|
||||
def test_hub_browse_on_branch
|
||||
stub_branch('refs/heads/feature')
|
||||
|
||||
assert_command "browse resque", "open http://github.com/tpw/resque"
|
||||
assert_command "browse resque", "open https://github.com/tpw/resque"
|
||||
assert_command "browse resque commits",
|
||||
"open http://github.com/tpw/resque/commits/master"
|
||||
"open https://github.com/tpw/resque/commits/master"
|
||||
|
||||
assert_command "browse",
|
||||
"open http://github.com/mislav/hub/tree/experimental"
|
||||
"open https://github.com/mislav/hub/tree/experimental"
|
||||
assert_command "browse -- tree",
|
||||
"open http://github.com/mislav/hub/tree/experimental"
|
||||
"open https://github.com/mislav/hub/tree/experimental"
|
||||
assert_command "browse -- commits",
|
||||
"open http://github.com/mislav/hub/commits/experimental"
|
||||
end
|
||||
|
||||
def test_hub_browse_self_private
|
||||
assert_command "browse -p github", "open https://github.com/tpw/github"
|
||||
"open https://github.com/mislav/hub/commits/experimental"
|
||||
end
|
||||
|
||||
def test_hub_browse_current
|
||||
assert_command "browse", "open http://github.com/defunkt/hub"
|
||||
assert_command "browse --", "open http://github.com/defunkt/hub"
|
||||
assert_command "browse", "open https://github.com/defunkt/hub"
|
||||
assert_command "browse --", "open https://github.com/defunkt/hub"
|
||||
end
|
||||
|
||||
def test_hub_browse_current_subpage
|
||||
assert_command "browse -- network",
|
||||
"open http://github.com/defunkt/hub/network"
|
||||
"open https://github.com/defunkt/hub/network"
|
||||
assert_command "browse -- anything/everything",
|
||||
"open http://github.com/defunkt/hub/anything/everything"
|
||||
"open https://github.com/defunkt/hub/anything/everything"
|
||||
end
|
||||
|
||||
def test_hub_browse_current_private
|
||||
|
@ -717,7 +696,7 @@ config
|
|||
|
||||
def test_multiple_remote_urls
|
||||
stub_repo_url("git://example.com/other.git\ngit://github.com/my/repo.git")
|
||||
assert_command "browse", "open http://github.com/my/repo"
|
||||
assert_command "browse", "open https://github.com/my/repo"
|
||||
end
|
||||
|
||||
protected
|
||||
|
@ -788,7 +767,7 @@ config
|
|||
end
|
||||
|
||||
def assert_browser(browser)
|
||||
assert_command "browse", "#{browser} http://github.com/defunkt/hub"
|
||||
assert_command "browse", "#{browser} https://github.com/defunkt/hub"
|
||||
end
|
||||
|
||||
def with_ruby_platform(value)
|
||||
|
|
Загрузка…
Ссылка в новой задаче