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
Tatuya Kamada
gitlab-ce
Commits
3b02ad84
Commit
3b02ad84
authored
Aug 11, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branches inside one repository using rugged instead of satellites"
This reverts commit
d24c40ec
.
parent
32046983
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
62 deletions
+6
-62
app/models/merge_request.rb
app/models/merge_request.rb
+1
-14
app/models/repository.rb
app/models/repository.rb
+2
-0
app/services/merge_requests/auto_merge_service.rb
app/services/merge_requests/auto_merge_service.rb
+3
-48
No files found.
app/models/merge_request.rb
View file @
3b02ad84
...
...
@@ -205,20 +205,7 @@ class MergeRequest < ActiveRecord::Base
end
def
check_if_can_be_merged
can_be_merged
=
if
for_fork?
Gitlab
::
Satellite
::
MergeAction
.
new
(
self
.
author
,
self
).
can_be_merged?
else
rugged
=
project
.
repository
.
rugged
our_commit
=
rugged
.
branches
[
target_branch
].
target
their_commit
=
rugged
.
branches
[
source_branch
].
target
if
our_commit
&&
their_commit
!
rugged
.
merge_commits
(
our_commit
,
their_commit
).
conflicts?
end
end
if
can_be_merged
if
Gitlab
::
Satellite
::
MergeAction
.
new
(
self
.
author
,
self
).
can_be_merged?
mark_as_mergeable
else
mark_as_unmergeable
...
...
app/models/repository.rb
View file @
3b02ad84
...
...
@@ -403,6 +403,8 @@ class Repository
Gitlab
::
Git
::
Blob
.
remove
(
raw_repository
,
options
)
end
private
def
user_to_comitter
(
user
)
{
email:
user
.
email
,
...
...
app/services/merge_requests/auto_merge_service.rb
View file @
3b02ad84
...
...
@@ -5,20 +5,17 @@ module MergeRequests
# mark merge request as merged and execute all hooks and notifications
# Called when you do merge via GitLab UI
class
AutoMergeService
<
BaseMergeService
attr_reader
:merge_request
,
:commit_message
def
execute
(
merge_request
,
commit_message
)
@commit_message
=
commit_message
@merge_request
=
merge_request
merge_request
.
lock_mr
if
merge!
if
Gitlab
::
Satellite
::
MergeAction
.
new
(
current_user
,
merge_request
).
merge!
(
commit_message
)
merge_request
.
merge
create_merge_event
(
merge_request
,
current_user
)
create_note
(
merge_request
)
notification_service
.
merge_mr
(
merge_request
,
current_user
)
execute_hooks
(
merge_request
,
'merge'
)
true
else
merge_request
.
unlock_mr
...
...
@@ -29,47 +26,5 @@ module MergeRequests
merge_request
.
mark_as_unmergeable
false
end
def
merge!
if
merge_request
.
for_fork?
Gitlab
::
Satellite
::
MergeAction
.
new
(
current_user
,
merge_request
).
merge!
(
commit_message
)
else
# Merge local branches using rugged instead of satellites
if
sha
=
commit
after_commit
(
sha
,
merge_request
.
target_branch
)
if
merge_request
.
remove_source_branch?
DeleteBranchService
.
new
(
merge_request
.
source_project
,
current_user
).
execute
(
merge_request
.
source_branch
)
end
true
else
false
end
end
end
def
commit
committer
=
repository
.
user_to_comitter
(
current_user
)
options
=
{
message:
commit_message
,
author:
committer
,
committer:
committer
}
repository
.
merge
(
merge_request
.
source_branch
,
merge_request
.
target_branch
,
options
)
end
def
after_commit
(
sha
,
branch
)
commit
=
repository
.
commit
(
sha
)
full_ref
=
"
#{
Gitlab
::
Git
::
BRANCH_REF_PREFIX
}#{
branch
}
"
old_sha
=
commit
.
parent_id
||
Gitlab
::
Git
::
BLANK_SHA
GitPushService
.
new
.
execute
(
project
,
current_user
,
old_sha
,
sha
,
full_ref
)
end
def
repository
project
.
repository
end
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