diff options
author | randx <dmitriy.zaporozhets@gmail.com> | 2012-03-29 18:03:05 +0300 |
---|---|---|
committer | randx <dmitriy.zaporozhets@gmail.com> | 2012-03-29 18:03:05 +0300 |
commit | 78d620b3b63fdd78b2cd1e4386822f93a701bc42 (patch) | |
tree | 4dd832c46f62778d34c18bdb91319ea7415793fe /app | |
parent | 8ee0993fdf783ad12823ff817cd531df0bc363eb (diff) | |
download | gitlab-ce-78d620b3b63fdd78b2cd1e4386822f93a701bc42.tar.gz |
Raw gitlab automerge feature
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/merge_requests_controller.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/app/controllers/merge_requests_controller.rb b/app/controllers/merge_requests_controller.rb index f882028fcab..609589d6b0b 100644 --- a/app/controllers/merge_requests_controller.rb +++ b/app/controllers/merge_requests_controller.rb @@ -2,7 +2,7 @@ class MergeRequestsController < ApplicationController before_filter :authenticate_user! before_filter :project before_filter :module_enabled - before_filter :merge_request, :only => [:edit, :update, :destroy, :show, :commits, :diffs] + before_filter :merge_request, :only => [:edit, :update, :destroy, :show, :commits, :diffs, :automerge] layout "project" # Authorize @@ -95,6 +95,22 @@ class MergeRequestsController < ApplicationController end end + def automerge + message = "" + if GitlabMerge.new(@merge_request).merge + @merge_request.update_attributes( + :author_id_of_changes => current_user.id, + :closed => true + ) + @merge_request.reload_code + message = "Successfully merged" + else + message = "Can not be merged" + end + + redirect_to [@merge_request.project, @merge_request], :alert => message + end + def destroy @merge_request.destroy |