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