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
9c03c1c5
Commit
9c03c1c5
authored
Jan 09, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make automerge via satellite
parent
bc95576e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
6 deletions
+32
-6
app/assets/javascripts/merge_request.js.coffee
app/assets/javascripts/merge_request.js.coffee
+13
-0
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+4
-3
app/views/projects/merge_requests/_show.html.haml
app/views/projects/merge_requests/_show.html.haml
+1
-1
app/views/projects/merge_requests/automerge.js.haml
app/views/projects/merge_requests/automerge.js.haml
+1
-2
app/workers/auto_merge_worker.rb
app/workers/auto_merge_worker.rb
+13
-0
No files found.
app/assets/javascripts/merge_request.js.coffee
View file @
9c03c1c5
...
...
@@ -135,3 +135,16 @@ class @MergeRequest
this
.
$
(
'.automerge_widget'
).
hide
()
this
.
$
(
'.merge-in-progress'
).
hide
()
this
.
$
(
'.automerge_widget.already_cannot_be_merged'
).
show
()
mergeInProgress
:
->
$
.
ajax
type
:
'GET'
url
:
$
(
'.merge-request'
).
data
(
'url'
)
success
:
(
data
)
=>
switch
data
.
state
when
'merged'
location
.
reload
()
else
setTimeout
(
merge_request
.
mergeInProgress
,
3000
)
dataType
:
'json'
app/controllers/projects/merge_requests_controller.rb
View file @
9c03c1c5
...
...
@@ -27,6 +27,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
respond_to
do
|
format
|
format
.
html
format
.
json
{
render
json:
@merge_request
}
format
.
diff
{
render
text:
@merge_request
.
to_diff
(
current_user
)
}
format
.
patch
{
render
text:
@merge_request
.
to_patch
(
current_user
)
}
end
...
...
@@ -104,15 +105,15 @@ class Projects::MergeRequestsController < Projects::ApplicationController
if
@merge_request
.
unchecked?
@merge_request
.
check_if_can_be_merged
end
render
json:
{
merge_status:
@merge_request
.
merge_status_name
}
render
json:
{
merge_status:
@merge_request
.
merge_status_name
}
end
def
automerge
return
access_denied!
unless
allowed_to_merge?
if
@merge_request
.
open?
&&
@merge_request
.
can_be_merged?
@merge_request
.
should_remove_source_branch
=
params
[
:should_remove_source_branch
]
@merge_request
.
automerge!
(
current_user
,
params
[
:commit_message
])
AutoMergeWorker
.
perform_async
(
@merge_request
.
id
,
current_user
.
id
,
params
)
@status
=
true
else
@status
=
false
...
...
app/views/projects/merge_requests/_show.html.haml
View file @
9c03c1c5
.merge-request
.merge-request
{
'data-url'
=>
project_merge_request_path
(
@project
,
@merge_request
)}
=
render
"projects/merge_requests/show/mr_title"
%hr
=
render
"projects/merge_requests/show/mr_box"
...
...
app/views/projects/merge_requests/automerge.js.haml
View file @
9c03c1c5
-
if
@status
:plain
location.reload
();
merge_request.mergeInProgress
();
-
else
:plain
merge_request.alreadyOrCannotBeMerged()
app/workers/auto_merge_worker.rb
0 → 100644
View file @
9c03c1c5
class
AutoMergeWorker
include
Sidekiq
::
Worker
sidekiq_options
queue: :default
def
perform
(
merge_request_id
,
current_user_id
,
params
)
params
=
params
.
with_indifferent_access
current_user
=
User
.
find
(
current_user_id
)
merge_request
=
MergeRequest
.
find
(
merge_request_id
)
merge_request
.
should_remove_source_branch
=
params
[
:should_remove_source_branch
]
merge_request
.
automerge!
(
current_user
,
params
[
:commit_message
])
end
end
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