Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
github
hub
提交
c41d4cfb
H
hub
项目概览
github
/
hub
11 个月 前同步成功
通知
3
Star
22523
Fork
2406
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c41d4cfb
编写于
4月 20, 2014
作者:
J
Jingwen Owen Ou
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #550 from github/merge_jingweno_gh
gh: Backport changes from gh master
上级
0000e933
418c71d4
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
38 addition
and
10 deletion
+38
-10
.goxc.json
.goxc.json
+1
-1
commands/browse.go
commands/browse.go
+1
-1
commands/help.go
commands/help.go
+1
-1
commands/selfupdate.go
commands/selfupdate.go
+4
-4
commands/utils.go
commands/utils.go
+4
-0
commands/utils_test.go
commands/utils_test.go
+18
-1
commands/version.go
commands/version.go
+1
-1
features/browse.feature
features/browse.feature
+8
-1
未找到文件。
.goxc.json
浏览文件 @
c41d4cfb
...
...
@@ -5,7 +5,7 @@
"ResourcesInclude"
:
"INSTALL*,README*,LICENSE*"
,
"ResourcesExclude"
:
"*.go"
,
"MainDirsExclude"
:
"Godeps"
,
"PackageVersion"
:
"
1
.0.0"
,
"PackageVersion"
:
"
2
.0.0"
,
"Verbosity"
:
"v"
,
"TaskSettings"
:
{
"downloads-page"
:
{
...
...
commands/browse.go
浏览文件 @
c41d4cfb
...
...
@@ -122,7 +122,7 @@ func parseFlagBrowseURLOnly(args *Args) bool {
}
func
branchInURL
(
branch
*
github
.
Branch
)
string
{
parts
:=
strings
.
Split
(
strings
.
Replace
(
branch
.
ShortName
(),
"."
,
"/"
,
-
1
),
"/"
)
parts
:=
strings
.
Split
(
branch
.
ShortName
(
),
"/"
)
newPath
:=
make
([]
string
,
len
(
parts
))
for
i
,
s
:=
range
parts
{
newPath
[
i
]
=
url
.
QueryEscape
(
s
)
...
...
commands/help.go
浏览文件 @
c41d4cfb
...
...
@@ -116,7 +116,7 @@ GitHub Commands:
ci-status Show the CI status of a commit
See 'git help <command>' for more information on a specific command.
Run 'git update' to update to the latest version of gh.
Run 'git
self
update' to update to the latest version of gh.
`
func
printUsage
()
{
...
...
commands/update.go
→
commands/
self
update.go
浏览文件 @
c41d4cfb
...
...
@@ -5,19 +5,19 @@ import (
"os"
)
var
cmd
U
pdate
=
&
Command
{
var
cmd
Selfu
pdate
=
&
Command
{
Run
:
update
,
Usage
:
"update"
,
Usage
:
"
self
update"
,
Short
:
"Update gh"
,
Long
:
`Update gh to the latest version.
Examples:
git update
git
self
update
`
,
}
func
init
()
{
CmdRunner
.
Use
(
cmd
U
pdate
)
CmdRunner
.
Use
(
cmd
Selfu
pdate
)
}
func
update
(
cmd
*
Command
,
args
*
Args
)
{
...
...
commands/utils.go
浏览文件 @
c41d4cfb
...
...
@@ -93,6 +93,10 @@ func getTitleAndBodyFromFlags(messageFlag, fileFlag string) (title, body string,
func
readMsg
(
msg
string
)
(
title
,
body
string
)
{
split
:=
strings
.
SplitN
(
msg
,
"
\n\n
"
,
2
)
if
len
(
split
)
==
1
{
split
=
strings
.
SplitN
(
msg
,
"
\\
n
\\
n"
,
2
)
}
title
=
strings
.
TrimSpace
(
split
[
0
])
if
len
(
split
)
>
1
{
body
=
strings
.
TrimSpace
(
split
[
1
])
...
...
commands/utils_test.go
浏览文件 @
c41d4cfb
package
commands
import
(
"github.com/bmizerany/assert"
"io/ioutil"
"os"
"testing"
"github.com/bmizerany/assert"
)
func
TestGetTitleAndBodyFromFlags
(
t
*
testing
.
T
)
{
s
:=
"just needs raven
\n\n
now it works"
title
,
body
,
err
:=
getTitleAndBodyFromFlags
(
s
,
""
)
assert
.
Equal
(
t
,
nil
,
err
)
assert
.
Equal
(
t
,
"just needs raven"
,
title
)
assert
.
Equal
(
t
,
"now it works"
,
body
)
s
=
"just needs raven
\\
n
\\
nnow it works"
title
,
body
,
err
=
getTitleAndBodyFromFlags
(
s
,
""
)
assert
.
Equal
(
t
,
nil
,
err
)
assert
.
Equal
(
t
,
"just needs raven"
,
title
)
assert
.
Equal
(
t
,
"now it works"
,
body
)
}
func
TestDirIsNotEmpty
(
t
*
testing
.
T
)
{
dir
:=
createTempDir
(
t
)
defer
os
.
RemoveAll
(
dir
)
...
...
commands/version.go
浏览文件 @
c41d4cfb
...
...
@@ -7,7 +7,7 @@ import (
"os"
)
const
Version
=
"
1
.0.0"
const
Version
=
"
2
.0.0"
var
cmdVersion
=
&
Command
{
Run
:
runVersion
,
...
...
features/browse.feature
浏览文件 @
c41d4cfb
...
...
@@ -107,13 +107,20 @@ Feature: hub browse
Then
there should be no output
# Then "open https://github.com/jashkenas/coffee-script/issues" should be run
Scenario
:
Complex
branch
Scenario
:
Forward Slash Delimited
branch
Given I am in "git
:
//github.com/mislav/dotfiles.git"
git
repo
And
git
"push.default"
is set to
"upstream"
And
I am on the
"foo/bar"
branch with upstream
"origin/baz/qux/moo"
When
I successfully run `hub browse`
Then "open https
:
//github.com/mislav/dotfiles/tree/baz/qux/moo"
should
be
run
Scenario
:
Dot Delimited branch
Given I am in "git
:
//github.com/mislav/dotfiles.git"
git
repo
And
git
"push.default"
is set to
"upstream"
And
I am on the
"fix-glob-for.js"
branch with upstream
"origin/fix-glob-for.js"
When
I successfully run `hub browse`
Then "open https
:
//github.com/mislav/dotfiles/tree/fix-glob-for.js"
should
be
run
Scenario
:
Wiki repo
Given I am in "git
:
//github.com/defunkt/hub.wiki.git"
git
repo
When
I successfully run `hub browse`
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录