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
Boxiang Sun
gitlab-ce
Commits
92464319
Commit
92464319
authored
11 years ago
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3252 from hiroponz/fix-timeout-large-repository
Fix timeout error while showing the network graph.
parents
7587a3b2
92de0faf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
22 deletions
+46
-22
app/models/network/graph.rb
app/models/network/graph.rb
+34
-13
features/support/env.rb
features/support/env.rb
+1
-1
spec/features/projects_spec.rb
spec/features/projects_spec.rb
+1
-1
spec/features/security/project_access_spec.rb
spec/features/security/project_access_spec.rb
+10
-7
No files found.
app/models/network/graph.rb
View file @
92464319
...
@@ -25,15 +25,7 @@ module Network
...
@@ -25,15 +25,7 @@ module Network
def
collect_commits
def
collect_commits
refs_cache
=
build_refs_cache
refs_cache
=
build_refs_cache
Grit
::
Commit
.
find_all
(
find_commits
(
count_to_display_commit_in_center
)
@repo
,
nil
,
{
date_order:
true
,
max_count:
self
.
class
.
max_count
,
skip:
count_to_display_commit_in_center
}
)
.
map
do
|
commit
|
.
map
do
|
commit
|
# Decorate with app/model/network/commit.rb
# Decorate with app/model/network/commit.rb
Network
::
Commit
.
new
(
commit
,
refs_cache
[
commit
.
id
])
Network
::
Commit
.
new
(
commit
,
refs_cache
[
commit
.
id
])
...
@@ -74,18 +66,47 @@ module Network
...
@@ -74,18 +66,47 @@ module Network
# Skip count that the target commit is displayed in center.
# Skip count that the target commit is displayed in center.
def
count_to_display_commit_in_center
def
count_to_display_commit_in_center
commit_index
=
Grit
::
Commit
.
find_all
(
@repo
,
nil
,
{
date_order:
true
}).
index
do
|
c
|
offset
=
-
1
c
.
id
==
@commit
.
id
skip
=
0
while
offset
==
-
1
tmp_commits
=
find_commits
(
skip
)
if
tmp_commits
.
size
>
0
index
=
tmp_commits
.
index
do
|
c
|
c
.
id
==
@commit
.
id
end
if
index
# Find the target commit
offset
=
index
+
skip
else
skip
+=
self
.
class
.
max_count
end
else
# Cant't find the target commit in the repo.
offset
=
0
end
end
end
if
commit_index
&&
(
self
.
class
.
max_count
/
2
<
commit_index
)
then
if
self
.
class
.
max_count
/
2
<
offset
then
# get max index that commit is displayed in the center.
# get max index that commit is displayed in the center.
commit_index
-
self
.
class
.
max_count
/
2
offset
-
self
.
class
.
max_count
/
2
else
else
0
0
end
end
end
end
def
find_commits
(
skip
=
0
)
Grit
::
Commit
.
find_all
(
@repo
,
nil
,
{
date_order:
true
,
max_count:
self
.
class
.
max_count
,
skip:
skip
}
)
end
def
commits_sort_by_ref
def
commits_sort_by_ref
@commits
.
sort
do
|
a
,
b
|
@commits
.
sort
do
|
a
,
b
|
if
include_ref?
(
a
)
if
include_ref?
(
a
)
...
...
This diff is collapsed.
Click to expand it.
features/support/env.rb
View file @
92464319
...
@@ -28,8 +28,8 @@ require 'capybara/poltergeist'
...
@@ -28,8 +28,8 @@ require 'capybara/poltergeist'
Capybara
.
javascript_driver
=
:poltergeist
Capybara
.
javascript_driver
=
:poltergeist
Spinach
.
hooks
.
on_tag
(
"javascript"
)
do
Spinach
.
hooks
.
on_tag
(
"javascript"
)
do
::
Capybara
.
current_driver
=
::
Capybara
.
javascript_driver
::
Capybara
.
current_driver
=
::
Capybara
.
javascript_driver
::
Capybara
.
default_wait_time
=
5
end
end
Capybara
.
default_wait_time
=
10
DatabaseCleaner
.
strategy
=
:truncation
DatabaseCleaner
.
strategy
=
:truncation
...
...
This diff is collapsed.
Click to expand it.
spec/features/projects_spec.rb
View file @
92464319
...
@@ -11,7 +11,7 @@ describe "Projects" do
...
@@ -11,7 +11,7 @@ describe "Projects" do
end
end
it
"should be correct path"
do
it
"should be correct path"
do
expect
{
click_link
"Remove"
}.
to
change
{
Project
.
count
}.
by
(
-
1
)
expect
{
click_link
"Remove
project
"
}.
to
change
{
Project
.
count
}.
by
(
-
1
)
end
end
end
end
end
end
This diff is collapsed.
Click to expand it.
spec/features/security/project_access_spec.rb
View file @
92464319
...
@@ -230,14 +230,17 @@ describe "Application access" do
...
@@ -230,14 +230,17 @@ describe "Application access" do
end
end
describe
"GET /project_code/files"
do
describe
"GET /project_code/files"
do
subject
{
files_project_path
(
project
)
}
pending
(
"ProjectsController#files have been deleted."
)
do
it
{
should
be_allowed_for
master
}
subject
{
files_project_path
(
project
)
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_allowed_for
master
}
it
{
should
be_denied_for
guest
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
:visitor
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
end
end
end
end
end
end
end
This diff is collapsed.
Click to expand it.
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