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
iv
gitlab-ce
Commits
29f70acc
Commit
29f70acc
authored
Feb 18, 2013
by
Andrew8xx8
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge Request uses StateMachine now
parent
b45e9aef
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
4 deletions
+21
-4
app/models/merge_request.rb
app/models/merge_request.rb
+1
-1
lib/api/entities.rb
lib/api/entities.rb
+1
-1
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+2
-2
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+17
-0
No files found.
app/models/merge_request.rb
View file @
29f70acc
...
@@ -25,7 +25,7 @@ class MergeRequest < ActiveRecord::Base
...
@@ -25,7 +25,7 @@ class MergeRequest < ActiveRecord::Base
include
Issuable
include
Issuable
attr_accessible
:title
,
:assignee_id
,
:target_branch
,
:source_branch
,
:milestone_id
,
attr_accessible
:title
,
:assignee_id
,
:target_branch
,
:source_branch
,
:milestone_id
,
:author_id_of_changes
:author_id_of_changes
,
:state_event
attr_accessor
:should_remove_source_branch
attr_accessor
:should_remove_source_branch
...
...
lib/api/entities.rb
View file @
29f70acc
...
@@ -81,7 +81,7 @@ module Gitlab
...
@@ -81,7 +81,7 @@ module Gitlab
end
end
class
MergeRequest
<
Grape
::
Entity
class
MergeRequest
<
Grape
::
Entity
expose
:id
,
:target_branch
,
:source_branch
,
:project_id
,
:title
,
:
closed
,
:merged
expose
:id
,
:target_branch
,
:source_branch
,
:project_id
,
:title
,
:
state
expose
:author
,
:assignee
,
using:
Entities
::
UserBasic
expose
:author
,
:assignee
,
using:
Entities
::
UserBasic
end
end
...
...
lib/api/merge_requests.rb
View file @
29f70acc
...
@@ -73,12 +73,12 @@ module Gitlab
...
@@ -73,12 +73,12 @@ module Gitlab
# target_branch - The target branch
# target_branch - The target branch
# assignee_id - Assignee user ID
# assignee_id - Assignee user ID
# title - Title of MR
# title - Title of MR
#
closed - Status of MR. true - closed
#
state_event - Status of MR. (close|reopen|merge)
# Example:
# Example:
# PUT /projects/:id/merge_request/:merge_request_id
# PUT /projects/:id/merge_request/:merge_request_id
#
#
put
":id/merge_request/:merge_request_id"
do
put
":id/merge_request/:merge_request_id"
do
attrs
=
attributes_for_keys
[
:source_branch
,
:target_branch
,
:assignee_id
,
:title
,
:
closed
]
attrs
=
attributes_for_keys
[
:source_branch
,
:target_branch
,
:assignee_id
,
:title
,
:
state_event
]
merge_request
=
user_project
.
merge_requests
.
find
(
params
[
:merge_request_id
])
merge_request
=
user_project
.
merge_requests
.
find
(
params
[
:merge_request_id
])
authorize!
:modify_merge_request
,
merge_request
authorize!
:modify_merge_request
,
merge_request
...
...
spec/requests/api/merge_requests_spec.rb
View file @
29f70acc
...
@@ -43,6 +43,23 @@ describe Gitlab::API do
...
@@ -43,6 +43,23 @@ describe Gitlab::API do
end
end
end
end
describe
"PUT /projects/:id/merge_request/:merge_request_id to close MR"
do
it
"should return merge_request"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_request/
#{
merge_request
.
id
}
"
,
user
),
state_event:
"close"
response
.
status
.
should
==
200
json_response
[
'state'
].
should
==
'closed'
end
end
describe
"PUT /projects/:id/merge_request/:merge_request_id to merge MR"
do
it
"should return merge_request"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_request/
#{
merge_request
.
id
}
"
,
user
),
state_event:
"merge"
response
.
status
.
should
==
200
json_response
[
'state'
].
should
==
'merged'
end
end
describe
"PUT /projects/:id/merge_request/:merge_request_id"
do
describe
"PUT /projects/:id/merge_request/:merge_request_id"
do
it
"should return merge_request"
do
it
"should return merge_request"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_request/
#{
merge_request
.
id
}
"
,
user
),
title:
"New title"
put
api
(
"/projects/
#{
project
.
id
}
/merge_request/
#{
merge_request
.
id
}
"
,
user
),
title:
"New title"
...
...
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