Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
9926f64f9563
Commit
a163135c
authored
Mar 20, 2013
by
Dmitriy Zaporozhets
Browse files
Intead of showing 404 give users ability to close MR with missing branches
parent
dd602593dbb9
Changes
6
Hide whitespace changes
Inline
Side-by-side
app/assets/stylesheets/common.scss
View file @
9926f64f
...
...
@@ -543,3 +543,15 @@ img.emoji {
.appear-data
{
display
:
none
;
}
.label-branch
{
@include
border-radius
(
4px
);
padding
:
2px
4px
;
border
:
none
;
font-size
:
14px
;
background
:
#474D57
;
color
:
#fff
;
font-family
:
$monospace_font
;
text-shadow
:
0
1px
1px
#111
;
font-weight
:
normal
;
}
app/assets/stylesheets/sections/merge_requests.scss
View file @
9926f64f
...
...
@@ -70,16 +70,6 @@ li.merge_request {
@extend
.append-bottom-10
;
}
.label_branch
{
@include
border-radius
(
4px
);
padding
:
2px
4px
;
border
:
none
;
font-size
:
14px
;
background
:
#474D57
;
color
:
#fff
;
font-family
:
$monospace_font
;
}
.mr_source_commit
,
.mr_target_commit
{
.commit
{
...
...
app/controllers/merge_requests_controller.rb
View file @
9926f64f
...
...
@@ -129,11 +129,11 @@ def module_enabled
def
validates_merge_request
# Show git not found page if target branch doesn't exist
return
git_not_found!
unless
@project
.
repo
.
heads
.
map
(
&
:name
).
include?
(
@merge_request
.
target_branch
)
return
invalid_mr
unless
@project
.
repo
.
heads
.
map
(
&
:name
).
include?
(
@merge_request
.
target_branch
)
# Show git not found page if source branch doesn't exist
# and there is no saved commits between source & target branch
return
git_not_found!
if
!
@project
.
repo
.
heads
.
map
(
&
:name
).
include?
(
@merge_request
.
source_branch
)
&&
@merge_request
.
commits
.
blank?
return
invalid_mr
if
!
@project
.
repo
.
heads
.
map
(
&
:name
).
include?
(
@merge_request
.
source_branch
)
&&
@merge_request
.
commits
.
blank?
end
def
define_show_vars
...
...
@@ -158,4 +158,9 @@ def allowed_to_merge?
can?
(
current_user
,
action
,
@project
)
end
def
invalid_mr
# Render special view for MR with removed source or target branch
render
'invalid'
end
end
app/views/compare/_form.html.haml
View file @
9926f64f
...
...
@@ -2,9 +2,9 @@
-
unless
params
[
:to
]
%p
.slead
Fill input field with commit id like
%code
.label
_
branch
4eedf23
%code
.label
-
branch
4eedf23
or branch/tag name like
%code
.label
_
branch
master
%code
.label
-
branch
master
and press compare button for commits list, code diff.
%br
...
...
app/views/merge_requests/invalid.html.haml
0 → 100644
View file @
9926f64f
.merge-request
=
render
"merge_requests/show/mr_title"
=
render
"merge_requests/show/mr_box"
.alert.alert-error
%h5
%i
.icon-exclamation-sign
We cannot find
%span
.label-branch
=
@merge_request
.
source_branch
or
%span
.label-branch
=
@merge_request
.
target_branch
branches in the repository.
%p
Maybe it was removed or never pushed.
%p
Please close Merge Request or change branches with existing one
app/views/merge_requests/show/_mr_title.html.haml
View file @
9926f64f
%h3
.page_title
=
"Merge Request #
#{
@merge_request
.
id
}
:"
%span
.label
_
branch
=
@merge_request
.
source_branch
%span
.label
-
branch
=
@merge_request
.
source_branch
→
%span
.label
_
branch
=
@merge_request
.
target_branch
%span
.label
-
branch
=
@merge_request
.
target_branch
%span
.pull-right
-
if
can?
(
current_user
,
:modify_merge_request
,
@merge_request
)
...
...
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