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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
0a6b64e6
Commit
0a6b64e6
authored
Jul 05, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MR: Handle broken diff ex. in case its too huge
parent
d40b9ce2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
19 deletions
+38
-19
app/models/merge_request.rb
app/models/merge_request.rb
+16
-3
app/views/layouts/_project_menu.html.haml
app/views/layouts/_project_menu.html.haml
+14
-13
app/views/merge_requests/show/_diffs.html.haml
app/views/merge_requests/show/_diffs.html.haml
+8
-3
No files found.
app/models/merge_request.rb
View file @
0a6b64e6
...
...
@@ -3,6 +3,8 @@ require File.join(Rails.root, "app/models/commit")
class
MergeRequest
<
ActiveRecord
::
Base
include
Upvote
BROKEN_DIFF
=
"--broken-diff"
UNCHECKED
=
1
CAN_BE_MERGED
=
2
CANNOT_BE_MERGED
=
3
...
...
@@ -108,14 +110,25 @@ class MergeRequest < ActiveRecord::Base
def
reloaded_diffs
if
open
?
&&
unmerged_diffs
.
any?
self
.
st_diffs
=
unmerged_diffs
save
s
elf
.
s
ave
end
diffs
rescue
Grit
::
Git
::
GitTimeout
self
.
st_diffs
=
[
BROKEN_DIFF
]
self
.
save
end
def
broken_diffs?
diffs
==
[
BROKEN_DIFF
]
end
def
valid_diffs?
!
broken_diffs?
end
def
unmerged_diffs
commits
=
project
.
repo
.
commits_between
(
target_branch
,
source_branch
).
map
{
|
c
|
Commit
.
new
(
c
)}
diffs
=
project
.
repo
.
diff
(
commits
.
first
.
prev_commit
.
id
,
commits
.
last
.
id
)
rescue
[]
diffs
=
project
.
repo
.
diff
(
commits
.
first
.
prev_commit
.
id
,
commits
.
last
.
id
)
end
def
last_commit
...
...
app/views/layouts/_project_menu.html.haml
View file @
0a6b64e6
...
...
@@ -13,24 +13,25 @@
%li
{
:class
=>
tab_class
(
:network
)}
=
link_to
"Network"
,
graph_project_path
(
@project
)
-
if
@project
.
issues_enabled
%li
{
:class
=>
tab_class
(
:issues
)}
=
link_to
project_issues_filter_path
(
@project
)
do
Issues
%span
.count
=
@project
.
issues
.
opened
.
count
-
if
@project
.
issues_enabled
%li
{
:class
=>
tab_class
(
:issues
)}
=
link_to
project_issues_filter_path
(
@project
)
do
Issues
%span
.count
=
@project
.
issues
.
opened
.
count
-
if
@project
.
repo_exists?
-
if
@project
.
merge_requests_enabled
%li
{
:class
=>
tab_class
(
:merge_requests
)}
=
link_to
project_merge_requests_path
(
@project
)
do
Merge Requests
%span
.count
=
@project
.
merge_requests
.
opened
.
count
-
if
@project
.
wall_enabled
%li
{
:class
=>
tab_class
(
:wall
)}
=
link_to
wall_project_path
(
@project
)
do
Wall
-
if
@project
.
wall_enabled
%li
{
:class
=>
tab_class
(
:wall
)}
=
link_to
wall_project_path
(
@project
)
do
Wall
-
if
@project
.
wiki_enabled
%li
{
:class
=>
tab_class
(
:wiki
)}
=
link_to
project_wiki_path
(
@project
,
:index
)
do
Wiki
-
if
@project
.
wiki_enabled
%li
{
:class
=>
tab_class
(
:wiki
)}
=
link_to
project_wiki_path
(
@project
,
:index
)
do
Wiki
app/views/merge_requests/show/_diffs.html.haml
View file @
0a6b64e6
=
render
"commits/diffs"
,
:diffs
=>
@diffs
-
if
@diffs
.
empty?
%p
.cgray
Nothing to merge
-
if
@merge_request
.
valid_diffs?
=
render
"commits/diffs"
,
:diffs
=>
@diffs
-
elsif
@merge_request
.
broken_diffs?
%h4
.nothing_here_message
Can't load diff.
You can
#{
link_to
"download MR patch"
,
raw_project_merge_request_path
(
@project
,
@merge_request
),
:class
=>
"vlink"
}
instead.
-
else
%h4
.nothing_here_message
Nothing to merge
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