Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
9c3db830
Commit
9c3db830
authored
Aug 23, 2016
by
Ben Boeckel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
entities: expose {,merge_commit_}sha in MergeRequest
Fixes #20456.
parent
a181d675
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
3 deletions
+33
-3
CHANGELOG
CHANGELOG
+1
-0
doc/api/merge_requests.md
doc/api/merge_requests.md
+22
-2
lib/api/entities.rb
lib/api/entities.rb
+2
-0
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+8
-1
No files found.
CHANGELOG
View file @
9c3db830
...
...
@@ -9,6 +9,7 @@ v 8.12.0 (unreleased)
- Change merge_error column from string to text type
- Reduce contributions calendar data payload (ClemMakesApps)
- Add `web_url` field to issue, merge request, and snippet API objects (Ben Boeckel)
- Expose `sha` and `merge_commit_sha` in merge request API (Ben Boeckel)
- Set path for all JavaScript cookies to honor GitLab's subdirectory setting !5627 (Mike Greiling)
- Shorten task status phrase (ClemMakesApps)
- Add hover color to emoji icon (ClemMakesApps)
...
...
doc/api/merge_requests.md
View file @
9c3db830
...
...
@@ -68,6 +68,8 @@ Parameters:
"merge_when_build_succeeds"
:
true
,
"merge_status"
:
"can_be_merged"
,
"subscribed"
:
false
,
"sha"
:
"8888888888888888888888888888888888888888"
,
"merge_commit_sha"
:
null
,
"user_notes_count"
:
1
,
"should_remove_source_branch"
:
true
,
"force_remove_source_branch"
:
false
,
...
...
@@ -135,6 +137,8 @@ Parameters:
"merge_when_build_succeeds"
:
true
,
"merge_status"
:
"can_be_merged"
,
"subscribed"
:
true
,
"sha"
:
"8888888888888888888888888888888888888888"
,
"merge_commit_sha"
:
"9999999999999999999999999999999999999999"
,
"user_notes_count"
:
1
,
"should_remove_source_branch"
:
true
,
"force_remove_source_branch"
:
false
,
...
...
@@ -238,6 +242,8 @@ Parameters:
"merge_when_build_succeeds"
:
true
,
"merge_status"
:
"can_be_merged"
,
"subscribed"
:
true
,
"sha"
:
"8888888888888888888888888888888888888888"
,
"merge_commit_sha"
:
null
,
"user_notes_count"
:
1
,
"should_remove_source_branch"
:
true
,
"force_remove_source_branch"
:
false
,
...
...
@@ -322,6 +328,8 @@ Parameters:
"merge_when_build_succeeds"
:
true
,
"merge_status"
:
"can_be_merged"
,
"subscribed"
:
true
,
"sha"
:
"8888888888888888888888888888888888888888"
,
"merge_commit_sha"
:
null
,
"user_notes_count"
:
0
,
"should_remove_source_branch"
:
true
,
"force_remove_source_branch"
:
false
,
...
...
@@ -397,6 +405,8 @@ Parameters:
"merge_when_build_succeeds"
:
true
,
"merge_status"
:
"can_be_merged"
,
"subscribed"
:
true
,
"sha"
:
"8888888888888888888888888888888888888888"
,
"merge_commit_sha"
:
null
,
"user_notes_count"
:
1
,
"should_remove_source_branch"
:
true
,
"force_remove_source_branch"
:
false
,
...
...
@@ -499,6 +509,8 @@ Parameters:
"merge_when_build_succeeds"
:
true
,
"merge_status"
:
"can_be_merged"
,
"subscribed"
:
true
,
"sha"
:
"8888888888888888888888888888888888888888"
,
"merge_commit_sha"
:
"9999999999999999999999999999999999999999"
,
"user_notes_count"
:
1
,
"should_remove_source_branch"
:
true
,
"force_remove_source_branch"
:
false
,
...
...
@@ -569,6 +581,8 @@ Parameters:
"merge_when_build_succeeds"
:
true
,
"merge_status"
:
"can_be_merged"
,
"subscribed"
:
true
,
"sha"
:
"8888888888888888888888888888888888888888"
,
"merge_commit_sha"
:
null
,
"user_notes_count"
:
1
,
"should_remove_source_branch"
:
true
,
"force_remove_source_branch"
:
false
,
...
...
@@ -724,7 +738,9 @@ Example response:
},
"merge_when_build_succeeds"
:
false
,
"merge_status"
:
"cannot_be_merged"
,
"subscribed"
:
true
"subscribed"
:
true
,
"sha"
:
"8888888888888888888888888888888888888888"
,
"merge_commit_sha"
:
null
}
```
...
...
@@ -798,7 +814,9 @@ Example response:
},
"merge_when_build_succeeds"
:
false
,
"merge_status"
:
"cannot_be_merged"
,
"subscribed"
:
false
"subscribed"
:
false
,
"sha"
:
"8888888888888888888888888888888888888888"
,
"merge_commit_sha"
:
null
}
```
...
...
@@ -891,6 +909,8 @@ Example response:
"merge_when_build_succeeds"
:
false
,
"merge_status"
:
"unchecked"
,
"subscribed"
:
true
,
"sha"
:
"8888888888888888888888888888888888888888"
,
"merge_commit_sha"
:
null
,
"user_notes_count"
:
7
,
"should_remove_source_branch"
:
true
,
"force_remove_source_branch"
:
false
,
...
...
lib/api/entities.rb
View file @
9c3db830
...
...
@@ -232,6 +232,8 @@ module API
expose
:milestone
,
using:
Entities
::
Milestone
expose
:merge_when_build_succeeds
expose
:merge_status
expose
:diff_head_sha
,
as: :sha
expose
:merge_commit_sha
expose
:subscribed
do
|
merge_request
,
options
|
merge_request
.
subscribed?
(
options
[
:current_user
])
end
...
...
spec/requests/api/merge_requests_spec.rb
View file @
9c3db830
...
...
@@ -9,7 +9,7 @@ describe API::API, api: true do
let!
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
:simple
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Test"
,
created_at:
base_time
)
}
let!
(
:merge_request_closed
)
{
create
(
:merge_request
,
state:
"closed"
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Closed test"
,
created_at:
base_time
+
1
.
second
)
}
let!
(
:merge_request_merged
)
{
create
(
:merge_request
,
state:
"merged"
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Merged test"
,
created_at:
base_time
+
2
.
seconds
)
}
let!
(
:merge_request_merged
)
{
create
(
:merge_request
,
state:
"merged"
,
author:
user
,
assignee:
user
,
source_project:
project
,
target_project:
project
,
title:
"Merged test"
,
created_at:
base_time
+
2
.
seconds
,
merge_commit_sha:
'9999999999999999999999999999999999999999'
)
}
let!
(
:note
)
{
create
(
:note_on_merge_request
,
author:
user
,
project:
project
,
noteable:
merge_request
,
note:
"a comment on a MR"
)
}
let!
(
:note2
)
{
create
(
:note_on_merge_request
,
author:
user
,
project:
project
,
noteable:
merge_request
,
note:
"another comment on a MR"
)
}
let
(
:milestone
)
{
create
(
:milestone
,
title:
'1.0.0'
,
project:
project
)
}
...
...
@@ -34,6 +34,13 @@ describe API::API, api: true do
expect
(
json_response
.
length
).
to
eq
(
3
)
expect
(
json_response
.
last
[
'title'
]).
to
eq
(
merge_request
.
title
)
expect
(
json_response
.
last
).
to
have_key
(
'web_url'
)
expect
(
json_response
.
last
[
'sha'
]).
to
eq
(
merge_request
.
diff_head_sha
)
expect
(
json_response
.
last
[
'merge_commit_sha'
]).
to
be_nil
expect
(
json_response
.
last
[
'merge_commit_sha'
]).
to
eq
(
merge_request
.
merge_commit_sha
)
expect
(
json_response
.
first
[
'title'
]).
to
eq
(
merge_request_merged
.
title
)
expect
(
json_response
.
first
[
'sha'
]).
to
eq
(
merge_request_merged
.
diff_head_sha
)
expect
(
json_response
.
first
[
'merge_commit_sha'
]).
not_to
be_nil
expect
(
json_response
.
first
[
'merge_commit_sha'
]).
to
eq
(
merge_request_merged
.
merge_commit_sha
)
end
it
"returns an array of all merge_requests"
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment