Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
github
hub
提交
08342b83
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,发现更多精彩内容 >>
提交
08342b83
编写于
11月 06, 2013
作者:
J
Jingwen Owen Ou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Return octokit.PullRequest
上级
0e0e61d7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
15 deletion
+13
-15
commands/pull_request.go
commands/pull_request.go
+11
-9
github/github.go
github/github.go
+2
-6
未找到文件。
commands/pull_request.go
浏览文件 @
08342b83
...
...
@@ -55,10 +55,7 @@ func init() {
[ attached pull request to issue #123 ]
*/
func
pullRequest
(
cmd
*
Command
,
args
*
Args
)
{
var
(
title
,
body
string
err
error
)
var
title
,
body
string
if
args
.
ParamsSize
()
==
1
{
title
=
args
.
RemoveParam
(
0
)
}
...
...
@@ -66,7 +63,10 @@ func pullRequest(cmd *Command, args *Args) {
gh
:=
github
.
New
()
repo
:=
gh
.
Project
.
LocalRepoWith
(
flagPullRequestBase
,
flagPullRequestHead
)
if
title
==
""
&&
flagPullRequestIssue
==
""
{
title
,
body
,
err
=
writePullRequestTitleAndBody
(
repo
)
t
,
b
,
err
:=
writePullRequestTitleAndBody
(
repo
)
utils
.
Check
(
err
)
title
=
t
body
=
b
}
if
title
==
""
&&
flagPullRequestIssue
==
""
{
...
...
@@ -79,14 +79,16 @@ func pullRequest(cmd *Command, args *Args) {
pullRequestURL
=
"PULL_REQUEST_URL"
}
else
{
if
title
!=
""
{
pullRequestURL
,
err
=
gh
.
CreatePullRequest
(
repo
.
Base
,
repo
.
Head
,
title
,
body
)
pr
,
err
:=
gh
.
CreatePullRequest
(
repo
.
Base
,
repo
.
Head
,
title
,
body
)
utils
.
Check
(
err
)
pullRequestURL
=
pr
.
HTMLURL
}
utils
.
Check
(
err
)
if
flagPullRequestIssue
!=
""
{
pullRequestURL
,
err
=
gh
.
CreatePullRequestForIssue
(
repo
.
Base
,
repo
.
Head
,
flagPullRequestIssue
)
pr
,
err
:=
gh
.
CreatePullRequestForIssue
(
repo
.
Base
,
repo
.
Head
,
flagPullRequestIssue
)
utils
.
Check
(
err
)
pullRequestURL
=
pr
.
HTMLURL
}
utils
.
Check
(
err
)
}
args
.
Replace
(
"echo"
,
""
,
pullRequestURL
)
...
...
github/github.go
浏览文件 @
08342b83
...
...
@@ -31,7 +31,7 @@ func (gh *GitHub) PullRequest(id string) (pr *octokit.PullRequest, err error) {
return
}
func
(
gh
*
GitHub
)
CreatePullRequest
(
base
,
head
,
title
,
body
string
)
(
url
string
,
err
error
)
{
func
(
gh
*
GitHub
)
CreatePullRequest
(
base
,
head
,
title
,
body
string
)
(
pr
*
octokit
.
PullRequest
,
err
error
)
{
client
:=
gh
.
octokit
()
prService
,
err
:=
client
.
PullRequests
(
&
octokit
.
PullRequestsURL
,
octokit
.
M
{
"owner"
:
gh
.
Project
.
Owner
,
"repo"
:
gh
.
Project
.
Name
})
if
err
!=
nil
{
...
...
@@ -44,12 +44,10 @@ func (gh *GitHub) CreatePullRequest(base, head, title, body string) (url string,
err
=
result
.
Err
}
url
=
pr
.
HTMLURL
return
}
func
(
gh
*
GitHub
)
CreatePullRequestForIssue
(
base
,
head
,
issue
string
)
(
url
string
,
err
error
)
{
func
(
gh
*
GitHub
)
CreatePullRequestForIssue
(
base
,
head
,
issue
string
)
(
pr
*
octokit
.
PullRequest
,
err
error
)
{
client
:=
gh
.
octokit
()
prService
,
err
:=
client
.
PullRequests
(
&
octokit
.
PullRequestsURL
,
octokit
.
M
{
"owner"
:
gh
.
Project
.
Owner
,
"repo"
:
gh
.
Project
.
Name
})
if
err
!=
nil
{
...
...
@@ -62,8 +60,6 @@ func (gh *GitHub) CreatePullRequestForIssue(base, head, issue string) (url strin
err
=
result
.
Err
}
url
=
pr
.
HTMLURL
return
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录