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
iv
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
Hide 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,14 +95,18 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -95,14 +95,18 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@note_counts
=
Note
.
where
(
commit_id:
@commits
.
map
(
&
:id
)).
@note_counts
=
Note
.
where
(
commit_id:
@commits
.
map
(
&
:id
)).
group
(
:commit_id
).
count
group
(
:commit_id
).
count
@diffs
=
compare_action
.
diffs
begin
@merge_request
.
title
=
@merge_request
.
source_branch
.
titleize
.
humanize
@diffs
=
compare_action
.
diffs
@target_project
=
@merge_request
.
target_project
@merge_request
.
title
=
@merge_request
.
source_branch
.
titleize
.
humanize
@target_repo
=
@target_project
.
repository
@target_project
=
@merge_request
.
target_project
@target_repo
=
@target_project
.
repository
diff_line_count
=
Commit
::
diff_line_count
(
@diffs
)
@suppress_diff
=
Commit
::
diff_suppress?
(
@diffs
,
diff_line_count
)
diff_line_count
=
Commit
::
diff_line_count
(
@diffs
)
@force_suppress_diff
=
@suppress_diff
@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
end
end
...
...
app/views/projects/merge_requests/_new_submit.html.haml
View file @
207bc8a0
...
@@ -10,72 +10,75 @@
...
@@ -10,72 +10,75 @@
%span
.pull-right
%span
.pull-right
=
link_to
'Change branches'
,
new_project_merge_request_path
(
@project
)
=
link_to
'Change branches'
,
new_project_merge_request_path
(
@project
)
-
if
@error
.
present?
.centered-light-block
%h4
#{
@error
}
-
else
=
form_for
[
@project
,
@merge_request
],
html:
{
class:
"merge-request-form"
}
do
|
f
|
.panel.panel-default
=
form_for
[
@project
,
@merge_request
],
html:
{
class:
"merge-request-form"
}
do
|
f
|
.panel-body
.panel.panel-default
.form-group
.light
=
f
.
label
:title
do
=
"Title *"
=
f
.
text_field
:title
,
class:
"form-control input-lg js-gfm-input"
,
maxlength:
255
,
rows:
5
,
required:
true
.form-group
.light
=
f
.
label
:description
,
"Description"
=
f
.
text_area
:description
,
class:
"form-control js-gfm-input markdown-area"
,
rows:
10
.clearfix.hint
.pull-left
Description is parsed with
#{
link_to
"GitLab Flavored Markdown"
,
help_page_path
(
"markdown"
,
"markdown"
),
target:
'_blank'
}
.
.pull-right
Attach images (JPG, PNG, GIF) by dragging
&
dropping or
#{
link_to
"selecting them"
,
'#'
,
class:
'markdown-selector'
}
.
.error-alert
.form-group
.issue-assignee
=
f
.
label
:assignee_id
do
%i
.icon-user
Assign to
%div
=
project_users_select_tag
(
'merge_request[assignee_id]'
,
placeholder:
'Select a user'
,
class:
'custom-form-control'
,
selected:
@merge_request
.
assignee_id
,
project_id:
@merge_request
.
target_project_id
)
=
link_to
'Assign to me'
,
'#'
,
class:
'btn assign-to-me-link'
.form-group
.issue-milestone
=
f
.
label
:milestone_id
do
%i
.icon-time
Milestone
%div
=
f
.
select
(
:milestone_id
,
milestone_options
(
@merge_request
),
{
include_blank:
"Select milestone"
},
{
class:
'select2'
})
.panel-footer
-
if
@target_repo
.
contribution_guide
-
contribution_guide_url
=
project_blob_path
(
@target_project
,
tree_join
(
@target_repo
.
root_ref
,
@target_repo
.
contribution_guide
.
name
))
%p
Please review the
%strong
#{
link_to
"guidelines for contribution"
,
contribution_guide_url
}
to this repository.
=
f
.
hidden_field
:source_project_id
=
f
.
hidden_field
:target_project_id
=
f
.
hidden_field
:target_branch
=
f
.
hidden_field
:source_branch
=
f
.
submit
'Submit merge request'
,
class:
"btn btn-create"
.panel-body
.mr-compare
.form-group
%div
.panel.panel-default
.light
.panel-heading
=
f
.
label
:title
do
Commits (
#{
@commits
.
count
}
)
=
"Title *"
-
if
@commits
.
size
>
MergeRequestDiff
::
COMMITS_SAFE_SIZE
=
f
.
text_field
:title
,
class:
"form-control input-lg js-gfm-input"
,
maxlength:
255
,
rows:
5
,
required:
true
%ul
.well-list
.form-group
-
Commit
.
decorate
(
@commits
.
first
(
MergeRequestDiff
::
COMMITS_SAFE_SIZE
)).
each
do
|
commit
|
.light
=
render
"projects/commits/inline_commit"
,
commit:
commit
,
project:
@project
=
f
.
label
:description
,
"Description"
%li
.warning-row.unstyled
=
f
.
text_area
:description
,
class:
"form-control js-gfm-input markdown-area"
,
rows:
10
other
#{
@commits
.
size
-
MergeRequestDiff
::
COMMITS_SAFE_SIZE
}
commits hidden to prevent performance issues.
.clearfix.hint
-
else
.pull-left
Description is parsed with
#{
link_to
"GitLab Flavored Markdown"
,
help_page_path
(
"markdown"
,
"markdown"
),
target:
'_blank'
}
.
%ul
.well-list
=
render
Commit
.
decorate
(
@commits
),
project:
@project
.pull-right
Attach images (JPG, PNG, GIF) by dragging
&
dropping or
#{
link_to
"selecting them"
,
'#'
,
class:
'markdown-selector'
}
.
.error-alert
.form-group
.issue-assignee
=
f
.
label
:assignee_id
do
%i
.icon-user
Assign to
%div
=
project_users_select_tag
(
'merge_request[assignee_id]'
,
placeholder:
'Select a user'
,
class:
'custom-form-control'
,
selected:
@merge_request
.
assignee_id
,
project_id:
@merge_request
.
target_project_id
)
=
link_to
'Assign to me'
,
'#'
,
class:
'btn assign-to-me-link'
.form-group
.issue-milestone
=
f
.
label
:milestone_id
do
%i
.icon-time
Milestone
%div
=
f
.
select
(
:milestone_id
,
milestone_options
(
@merge_request
),
{
include_blank:
"Select milestone"
},
{
class:
'select2'
})
.panel-footer
-
if
@target_repo
.
contribution_guide
-
contribution_guide_url
=
project_blob_path
(
@target_project
,
tree_join
(
@target_repo
.
root_ref
,
@target_repo
.
contribution_guide
.
name
))
%p
Please review the
%strong
#{
link_to
"guidelines for contribution"
,
contribution_guide_url
}
to this repository.
=
f
.
hidden_field
:source_project_id
=
f
.
hidden_field
:target_project_id
=
f
.
hidden_field
:target_branch
=
f
.
hidden_field
:source_branch
=
f
.
submit
'Submit merge request'
,
class:
"btn btn-create"
.mr-compare
%h4
Changes
%div
.panel.panel-default
-
if
@diffs
.
present?
.panel-heading
=
render
"projects/commits/diffs"
,
diffs:
@diffs
,
project:
@project
Commits (
#{
@commits
.
count
}
)
-
elsif
@commits
.
size
>
MergeRequestDiff
::
COMMITS_SAFE_SIZE
-
if
@commits
.
size
>
MergeRequestDiff
::
COMMITS_SAFE_SIZE
.bs-callout.bs-callout-danger
%ul
.well-list
%h4
This comparison includes more than
#{
MergeRequestDiff
::
COMMITS_SAFE_SIZE
}
commits.
-
Commit
.
decorate
(
@commits
.
first
(
MergeRequestDiff
::
COMMITS_SAFE_SIZE
)).
each
do
|
commit
|
%p
To preserve performance the line changes are not shown.
=
render
"projects/commits/inline_commit"
,
commit:
commit
,
project:
@project
%li
.warning-row.unstyled
other
#{
@commits
.
size
-
MergeRequestDiff
::
COMMITS_SAFE_SIZE
}
commits hidden to prevent performance issues.
-
else
%ul
.well-list
=
render
Commit
.
decorate
(
@commits
),
project:
@project
%h4
Changes
-
if
@diffs
.
present?
=
render
"projects/commits/diffs"
,
diffs:
@diffs
,
project:
@project
-
elsif
@commits
.
size
>
MergeRequestDiff
::
COMMITS_SAFE_SIZE
.bs-callout.bs-callout-danger
%h4
This comparison includes more than
#{
MergeRequestDiff
::
COMMITS_SAFE_SIZE
}
commits.
%p
To preserve performance the line changes are not shown.
:javascript
:javascript
...
...
lib/gitlab/satellite/compare_action.rb
View file @
207bc8a0
module
Gitlab
module
Gitlab
module
Satellite
module
Satellite
class
BranchesWithoutParent
<
StandardError
;
end
class
CompareAction
<
Action
class
CompareAction
<
Action
def
initialize
(
user
,
target_project
,
target_branch
,
source_project
,
source_branch
)
def
initialize
(
user
,
target_project
,
target_branch
,
source_project
,
source_branch
)
super
user
,
target_project
super
user
,
target_project
...
@@ -22,7 +24,7 @@ module Gitlab
...
@@ -22,7 +24,7 @@ module Gitlab
diffs
diffs
end
end
rescue
Grit
::
Git
::
CommandFailed
=>
ex
rescue
Grit
::
Git
::
CommandFailed
=>
ex
handle_exception
(
ex
)
raise
BranchesWithoutParent
end
end
# Retrieve an array of commits between the source and the target
# 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