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
8eae01ea
Unverified
Commit
8eae01ea
authored
May 08, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compare branches in MergeRequestsController#new action
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
05e63fe0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+20
-4
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
8eae01ea
...
...
@@ -62,11 +62,27 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request
.
source_project
=
@project
unless
@merge_request
.
source_project
@merge_request
.
target_project
||=
(
@project
.
forked_from_project
||
@project
)
@target_branches
=
@merge_request
.
target_project
.
nil?
?
[]
:
@merge_request
.
target_project
.
repository
.
branch_names
@merge_request
.
target_branch
||=
@merge_request
.
target_project
.
default_branch
@source_project
=
@merge_request
.
source_project
@merge_request
if
@merge_request
.
target_branch
&&
@merge_request
.
source_branch
compare_action
=
Gitlab
::
Satellite
::
CompareAction
.
new
(
current_user
,
@merge_request
.
target_project
,
@merge_request
.
target_branch
,
@merge_request
.
source_project
,
@merge_request
.
source_branch
)
@commits
=
compare_action
.
commits
@commits
.
map!
{
|
commit
|
Commit
.
new
(
commit
)
}
@commit
=
@commits
.
first
@diffs
=
compare_action
.
diffs
@merge_request
.
title
=
@merge_request
.
source_branch
.
titleize
.
humanize
@target_project
=
@merge_request
.
target_project
@target_repo
=
@target_project
.
repository
end
end
def
edit
...
...
@@ -80,7 +96,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request
=
MergeRequests
::
CreateService
.
new
(
project
,
current_user
,
params
[
:merge_request
]).
execute
if
@merge_request
.
valid?
redirect_to
[
@merge_request
.
target_project
,
@merge_request
]
,
notice:
'Merge request was successfully created.'
redirect_to
project_merge_request_path
(
@merge_request
.
target_project
,
@merge_request
)
,
notice:
'Merge request was successfully created.'
else
@source_project
=
@merge_request
.
source_project
@target_project
=
@merge_request
.
target_project
...
...
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