BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
7c6287c8
Unverified
Commit
7c6287c8
authored
Jan 13, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support of custom message to merge action of satellite
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
5c1a360f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
15 deletions
+12
-15
merge_action.rb
lib/gitlab/satellite/merge_action.rb
+12
-15
No files found.
lib/gitlab/satellite/merge_action.rb
View file @
7c6287c8
...
...
@@ -125,34 +125,31 @@ module Gitlab
#
# Returns false if the merge produced conflicts
# Returns true otherwise
def
merge_in_satellite!
(
repo
)
def
merge_in_satellite!
(
repo
,
message
=
nil
)
update_satellite_source_and_target!
(
repo
)
merge_message
=
"Merge branch '
#{
merge_request
.
source_branch
}
' into '
#{
merge_request
.
target_branch
}
'"
if
message
merge_message
<<
"
\n\n
"
merge_message
<<
message
end
# merge the source branch into the satellite
# will raise CommandFailed when merge fails
if
merge_request
.
for_fork?
repo
.
git
.
pull
(
default_options
({
no_ff:
true
}),
'source'
,
merge_request
.
source_branch
)
else
repo
.
git
.
pull
(
default_options
({
no_ff:
true
}),
'origin'
,
merge_request
.
source_branch
)
end
repo
.
git
.
merge
(
default_options
({
no_ff:
true
}),
"-m
#{
merge_message
}
"
,
"source/
#{
merge_request
.
source_branch
}
"
)
rescue
Grit
::
Git
::
CommandFailed
=>
ex
handle_exception
(
ex
)
end
# Assumes a satellite exists that is a fresh clone of the projects repo, prepares satellite for merges, diffs etc
def
update_satellite_source_and_target!
(
repo
)
if
merge_request
.
for_fork?
repo
.
remote_add
(
'source'
,
merge_request
.
source_project
.
repository
.
path_to_repo
)
repo
.
remote_fetch
(
'source'
)
repo
.
git
.
checkout
(
default_options
({
b:
true
}),
merge_request
.
target_branch
,
"origin/
#{
merge_request
.
target_branch
}
"
)
else
repo
.
git
.
checkout
(
default_options
,
"
#{
merge_request
.
source_branch
}
"
)
repo
.
git
.
checkout
(
default_options
({
t:
true
}),
"origin/
#{
merge_request
.
target_branch
}
"
)
end
repo
.
remote_add
(
'source'
,
merge_request
.
source_project
.
repository
.
path_to_repo
)
repo
.
remote_fetch
(
'source'
)
repo
.
git
.
checkout
(
default_options
({
b:
true
}),
merge_request
.
target_branch
,
"origin/
#{
merge_request
.
target_branch
}
"
)
rescue
Grit
::
Git
::
CommandFailed
=>
ex
handle_exception
(
ex
)
end
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