Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
github
hub
提交
b9e86a5d
H
hub
项目概览
github
/
hub
10 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
b9e86a5d
编写于
6月 06, 2018
作者:
M
Mislav Marohnić
提交者:
GitHub
6月 06, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1734 from HaraldNordgren/pull_request_no_edit
Create '--no-edit' option for hub pull-request
上级
84c49c5f
a9bb7333
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
96 addition
and
1 deletion
+96
-1
commands/pull_request.go
commands/pull_request.go
+15
-1
features/pull_request.feature
features/pull_request.feature
+81
-0
未找到文件。
commands/pull_request.go
浏览文件 @
b9e86a5d
...
...
@@ -32,6 +32,10 @@ pull-request -i <ISSUE>
Use the first line of <MESSAGE> as pull request title, and the rest as pull
request description.
--no-edit
Use the message from the first commit on the branch as pull request title
and description without opening a text editor.
-F, --file <FILE>
Read the pull request title and description from <FILE>.
...
...
@@ -93,7 +97,8 @@ var (
flagPullRequestCopy
,
flagPullRequestEdit
,
flagPullRequestPush
,
flagPullRequestForce
bool
flagPullRequestForce
,
flagPullRequestNoEdit
bool
flagPullRequestAssignees
,
flagPullRequestReviewers
,
...
...
@@ -110,6 +115,7 @@ func init() {
cmdPullRequest
.
Flag
.
BoolVarP
(
&
flagPullRequestEdit
,
"edit"
,
"e"
,
false
,
"EDIT"
)
cmdPullRequest
.
Flag
.
BoolVarP
(
&
flagPullRequestPush
,
"push"
,
"p"
,
false
,
"PUSH"
)
cmdPullRequest
.
Flag
.
BoolVarP
(
&
flagPullRequestForce
,
"force"
,
"f"
,
false
,
"FORCE"
)
cmdPullRequest
.
Flag
.
BoolVarP
(
&
flagPullRequestNoEdit
,
"no-edit"
,
""
,
false
,
"NO-EDIT"
)
cmdPullRequest
.
Flag
.
StringVarP
(
&
flagPullRequestFile
,
"file"
,
"F"
,
""
,
"FILE"
)
cmdPullRequest
.
Flag
.
VarP
(
&
flagPullRequestAssignees
,
"assign"
,
"a"
,
"USERS"
)
cmdPullRequest
.
Flag
.
VarP
(
&
flagPullRequestReviewers
,
"reviewer"
,
"r"
,
"USERS"
)
...
...
@@ -237,6 +243,14 @@ of text is the title and the rest is the description.`, fullBase, fullHead))
messageBuilder
.
Message
,
err
=
msgFromFile
(
flagPullRequestFile
)
utils
.
Check
(
err
)
messageBuilder
.
Edit
=
flagPullRequestEdit
}
else
if
flagPullRequestNoEdit
{
commits
,
_
:=
git
.
RefList
(
baseTracking
,
head
)
if
len
(
commits
)
==
0
{
utils
.
Check
(
fmt
.
Errorf
(
"Aborted: no commits detected between %s and %s"
,
baseTracking
,
head
))
}
message
,
err
:=
git
.
Show
(
commits
[
len
(
commits
)
-
1
])
utils
.
Check
(
err
)
messageBuilder
.
Message
=
message
}
else
if
flagPullRequestIssue
==
""
{
messageBuilder
.
Edit
=
true
...
...
features/pull_request.feature
浏览文件 @
b9e86a5d
...
...
@@ -160,6 +160,87 @@ Feature: hub pull-request
When
I successfully run `hub pull-request`
Then the output should contain exactly "the
:
//url\n"
Scenario
:
Single-commit pull request with "--no-edit"
Given the GitHub API server
:
"""
post('/repos/mislav/coral/pulls') {
assert :title => 'Commit title 1',
:body => 'Commit body 1'
status 201
json :html_url => "the://url"
}
"""
Given
I am on the
"master"
branch pushed to
"origin/master"
When
I successfully run `git checkout --quiet -b topic`
Given I make a commit with message
:
"""
Commit title 1
Commit body 1
"""
And
the
"topic"
branch is pushed to
"origin/topic"
When
I successfully run `hub pull-request --no-edit`
Then the output should contain exactly "the
:
//url\n"
Scenario
:
Multiple-commit pull request with "--no-edit"
Given the GitHub API server
:
"""
post('/repos/mislav/coral/pulls') {
assert :title => 'Commit title 1',
:body => 'Commit body 1'
status 201
json :html_url => "the://url"
}
"""
Given
I am on the
"master"
branch pushed to
"origin/master"
When
I successfully run `git checkout --quiet -b topic`
Given I make a commit with message
:
"""
Commit title 1
Commit body 1
"""
Given I make a commit with message
:
"""
Commit title 2
Commit body 2
"""
And
the
"topic"
branch is pushed to
"origin/topic"
When
I successfully run `hub pull-request --no-edit`
Then the output should contain exactly "the
:
//url\n"
Scenario
:
Pull request with "--push" and "--no-edit"
Given the GitHub API server
:
"""
post('/repos/mislav/coral/pulls') {
assert :title => 'Commit title 1',
:body => 'Commit body 1'
status 201
json :html_url => "the://url"
}
"""
Given
I am on the
"master"
branch pushed to
"origin/master"
When
I successfully run `git checkout --quiet -b topic`
Given I make a commit with message
:
"""
Commit title 1
Commit body 1
"""
When
I successfully run `hub pull-request --push --no-edit`
Then the output should contain exactly "the
:
//url\n"
Scenario
:
No
commits with
"--no-edit"
Given
I am on the
"master"
branch pushed to
"origin/master"
When
I successfully run `git checkout --quiet -b topic`
And
I run `hub pull-request --no-edit`
Then
the exit status should be 1
And the stderr should contain exactly
:
"""
Aborted: no commits detected between origin/master and topic\n
"""
Scenario
:
Message template should include git log summary between base and head
Given the text editor adds
:
"""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录