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
Kazuhiko Shiozaki
gitlab-ce
Commits
207bc8a0
Commit
207bc8a0
authored
Jul 14, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Branches without parent commit cannot be merged.
parent
25c9bf4b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
72 deletions
+81
-72
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+12
-8
app/views/projects/merge_requests/_new_submit.html.haml
app/views/projects/merge_requests/_new_submit.html.haml
+66
-63
lib/gitlab/satellite/compare_action.rb
lib/gitlab/satellite/compare_action.rb
+3
-1
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
207bc8a0
...
...
@@ -95,6 +95,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@note_counts
=
Note
.
where
(
commit_id:
@commits
.
map
(
&
:id
)).
group
(
:commit_id
).
count
begin
@diffs
=
compare_action
.
diffs
@merge_request
.
title
=
@merge_request
.
source_branch
.
titleize
.
humanize
@target_project
=
@merge_request
.
target_project
...
...
@@ -103,6 +104,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController
diff_line_count
=
Commit
::
diff_line_count
(
@diffs
)
@suppress_diff
=
Commit
::
diff_suppress?
(
@diffs
,
diff_line_count
)
@force_suppress_diff
=
@suppress_diff
rescue
Gitlab
::
Satellite
::
BranchesWithoutParent
@error
=
"Selected branches have no common commit so they cannot be compared."
end
end
end
...
...
app/views/projects/merge_requests/_new_submit.html.haml
View file @
207bc8a0
...
...
@@ -10,8 +10,11 @@
%span
.pull-right
=
link_to
'Change branches'
,
new_project_merge_request_path
(
@project
)
=
form_for
[
@project
,
@merge_request
],
html:
{
class:
"merge-request-form"
}
do
|
f
|
-
if
@error
.
present?
.centered-light-block
%h4
#{
@error
}
-
else
=
form_for
[
@project
,
@merge_request
],
html:
{
class:
"merge-request-form"
}
do
|
f
|
.panel.panel-default
.panel-body
...
...
@@ -56,7 +59,7 @@
=
f
.
hidden_field
:source_branch
=
f
.
submit
'Submit merge request'
,
class:
"btn btn-create"
.mr-compare
.mr-compare
%div
.panel.panel-default
.panel-heading
Commits (
#{
@commits
.
count
}
)
...
...
lib/gitlab/satellite/compare_action.rb
View file @
207bc8a0
module
Gitlab
module
Satellite
class
BranchesWithoutParent
<
StandardError
;
end
class
CompareAction
<
Action
def
initialize
(
user
,
target_project
,
target_branch
,
source_project
,
source_branch
)
super
user
,
target_project
...
...
@@ -22,7 +24,7 @@ module Gitlab
diffs
end
rescue
Grit
::
Git
::
CommandFailed
=>
ex
handle_exception
(
ex
)
raise
BranchesWithoutParent
end
# Retrieve an array of commits between the source and the target
...
...
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