Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
github
hub
提交
e0b66f06
H
hub
项目概览
github
/
hub
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
e0b66f06
编写于
9月 20, 2013
作者:
J
Jingwen Owen Ou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove sysexec since Windows doesn't support it…:-(
上级
edabaedb
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
8 addition
and
40 deletion
+8
-40
cmd/cmd.go
cmd/cmd.go
+0
-15
commands/browse.go
commands/browse.go
+1
-1
commands/runner.go
commands/runner.go
+3
-10
git/git.go
git/git.go
+0
-10
github/github.go
github/github.go
+4
-4
未找到文件。
cmd/cmd.go
浏览文件 @
e0b66f06
...
...
@@ -5,7 +5,6 @@ import (
"os"
"os/exec"
"strings"
"syscall"
)
type
Cmd
struct
{
...
...
@@ -53,20 +52,6 @@ func (cmd *Cmd) Exec() error {
return
c
.
Run
()
}
func
(
cmd
*
Cmd
)
SysExec
()
error
{
binary
,
lookErr
:=
exec
.
LookPath
(
cmd
.
Name
)
if
lookErr
!=
nil
{
return
fmt
.
Errorf
(
"command not found: %s"
,
cmd
.
Name
)
}
args
:=
[]
string
{
cmd
.
Name
}
args
=
append
(
args
,
cmd
.
Args
...
)
env
:=
os
.
Environ
()
return
syscall
.
Exec
(
binary
,
args
,
env
)
}
func
New
(
name
string
)
*
Cmd
{
return
&
Cmd
{
Name
:
name
,
Args
:
make
([]
string
,
0
)}
}
...
...
commands/browse.go
浏览文件 @
e0b66f06
...
...
@@ -64,6 +64,6 @@ func browse(command *Command, args *Args) {
utils
.
Check
(
err
)
}
args
.
Replace
(
launcher
[
0
],
""
,
launcher
[
1
:
]
...
)
args
.
Replace
(
launcher
[
0
],
""
,
launcher
[
1
:
]
...
)
args
.
AppendParams
(
url
)
}
commands/runner.go
浏览文件 @
e0b66f06
...
...
@@ -54,7 +54,7 @@ func (r *Runner) Execute() error {
}
}
return
git
.
S
ysExec
(
args
.
Command
,
args
.
Params
...
)
return
git
.
S
pawn
(
args
.
Command
,
args
.
Params
...
)
}
func
slurpGlobalFlags
(
args
*
Args
)
{
...
...
@@ -73,15 +73,8 @@ func printCommands(cmds []*cmd.Cmd) {
}
func
executeCommands
(
cmds
[]
*
cmd
.
Cmd
)
error
{
length
:=
len
(
cmds
)
for
i
,
c
:=
range
cmds
{
var
err
error
if
i
==
(
length
-
1
)
{
err
=
c
.
SysExec
()
}
else
{
err
=
c
.
Exec
()
}
for
_
,
c
:=
range
cmds
{
err
:=
c
.
Exec
()
if
err
!=
nil
{
return
err
}
...
...
git/git.go
浏览文件 @
e0b66f06
...
...
@@ -116,16 +116,6 @@ func Config(name string) (string, error) {
return
output
[
0
],
nil
}
func
SysExec
(
command
string
,
args
...
string
)
error
{
cmd
:=
cmd
.
New
(
"git"
)
cmd
.
WithArg
(
command
)
for
_
,
a
:=
range
args
{
cmd
.
WithArg
(
a
)
}
return
cmd
.
SysExec
()
}
func
Spawn
(
command
string
,
args
...
string
)
error
{
cmd
:=
cmd
.
New
(
"git"
)
cmd
.
WithArg
(
command
)
...
...
github/github.go
浏览文件 @
e0b66f06
...
...
@@ -59,7 +59,7 @@ func (gh *GitHub) CreateRepository(project Project, description, homepage string
func
(
gh
*
GitHub
)
CreatePullRequestForIssue
(
base
,
head
,
issue
string
)
(
string
,
error
)
{
client
:=
gh
.
client
()
params
:=
octokat
.
PullRequestForIssueParams
{
Base
:
base
,
Head
:
head
,
Issue
:
issue
}
params
:=
octokat
.
PullRequestForIssueParams
{
Base
:
base
,
Head
:
head
,
Issue
:
issue
}
pullRequest
,
err
:=
client
.
CreatePullRequestForIssue
(
gh
.
repo
(),
params
)
if
err
!=
nil
{
return
""
,
err
...
...
@@ -85,14 +85,14 @@ func (gh *GitHub) CiStatus(sha string) (*octokat.Status, error) {
func
(
gh
*
GitHub
)
ForkRepository
(
name
,
owner
string
,
noRemote
bool
)
(
repo
*
octokat
.
Repository
,
err
error
)
{
client
:=
gh
.
client
()
config
:=
gh
.
Config
repo
,
err
=
client
.
Repository
(
octokat
.
Repo
{
Name
:
name
,
UserName
:
config
.
User
})
repo
,
err
=
client
.
Repository
(
octokat
.
Repo
{
Name
:
name
,
UserName
:
config
.
User
})
if
repo
!=
nil
&&
err
==
nil
{
msg
:=
fmt
.
Sprintf
(
"Error creating fork: %s exists on %s"
,
repo
.
FullName
,
GitHubHost
)
err
=
errors
.
New
(
msg
)
return
}
repo
,
err
=
client
.
Fork
(
octokat
.
Repo
{
Name
:
name
,
UserName
:
owner
},
nil
)
repo
,
err
=
client
.
Fork
(
octokat
.
Repo
{
Name
:
name
,
UserName
:
owner
},
nil
)
return
}
...
...
@@ -109,7 +109,7 @@ func (gh *GitHub) ExpandRemoteUrl(owner, name string, isSSH bool) (url string) {
func
(
gh
*
GitHub
)
repo
()
octokat
.
Repo
{
project
:=
gh
.
Project
return
octokat
.
Repo
{
Name
:
project
.
Name
,
UserName
:
project
.
Owner
}
return
octokat
.
Repo
{
Name
:
project
.
Name
,
UserName
:
project
.
Owner
}
}
func
findOrCreateToken
(
user
,
password
string
)
(
string
,
error
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录