GitLab server-side merge
Methods
- C
- M
- N
Attributes
[RW] | merge_request |
Class Public methods
new(user, merge_request)
Link
Source: show
# File lib/gitlab/satellite/merge_action.rb, line 7 def initialize(user, merge_request) super user, merge_request.project @merge_request = merge_request end
Instance Public methods
can_be_merged?()
Link
Checks if a merge request can be executed without user interaction
Source: show
# File lib/gitlab/satellite/merge_action.rb, line 13 def can_be_merged? in_locked_and_timed_satellite do |merge_repo| merge_in_satellite!(merge_repo) end end
merge!()
Link
Merges the source branch into the target branch in the satellite and pushes it back to Gitolite. It also removes the source branch if requested in the merge request.
Returns false if the merge produced conflicts Returns false if pushing from the satellite to Gitolite failed or was rejected Returns true otherwise
Source: show
# File lib/gitlab/satellite/merge_action.rb, line 26 def merge! in_locked_and_timed_satellite do |merge_repo| if merge_in_satellite!(merge_repo) # push merge back to Gitolite # will raise CommandFailed when push fails merge_repo.git.push({raise: true, timeout: true}, :origin, merge_request.target_branch) # remove source branch if merge_request.should_remove_source_branch && !project.root_ref?(merge_request.source_branch) # will raise CommandFailed when push fails merge_repo.git.push({raise: true, timeout: true}, :origin, ":#{merge_request.source_branch}") end # merge, push and branch removal successful true end end rescue Grit::Git::CommandFailed => ex Gitlab::GitLogger.error(ex.message) false end