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
46fa9218
Commit
46fa9218
authored
Mar 19, 2013
by
Sato Hiroyuki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor: removing duplicate code.
parent
7587a3b2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
app/models/network/graph.rb
app/models/network/graph.rb
+14
-10
No files found.
app/models/network/graph.rb
View file @
46fa9218
...
@@ -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,7 +66,7 @@ module Network
...
@@ -74,7 +66,7 @@ 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
|
commit_index
=
find_commits
.
index
do
|
c
|
c
.
id
==
@commit
.
id
c
.
id
==
@commit
.
id
end
end
...
@@ -86,6 +78,18 @@ module Network
...
@@ -86,6 +78,18 @@ module Network
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
)
...
...
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