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
dc844f01
Commit
dc844f01
authored
Nov 13, 2011
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Graph: small refactoring
parent
c8968260
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
10 deletions
+6
-10
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+4
-1
lib/graph_commit.rb
lib/graph_commit.rb
+2
-9
No files found.
app/controllers/projects_controller.rb
View file @
dc844f01
...
@@ -181,7 +181,10 @@ class ProjectsController < ApplicationController
...
@@ -181,7 +181,10 @@ class ProjectsController < ApplicationController
def
add_refs
(
commit
,
ref_cache
)
def
add_refs
(
commit
,
ref_cache
)
if
ref_cache
.
empty?
if
ref_cache
.
empty?
@repo
.
refs
.
each
{
|
ref
|
ref_cache
[
ref
.
commit
.
id
]
||=
[];
ref_cache
[
ref
.
commit
.
id
]
<<
ref
}
@repo
.
refs
.
each
do
|
ref
|
ref_cache
[
ref
.
commit
.
id
]
||=
[]
ref_cache
[
ref
.
commit
.
id
]
<<
ref
end
end
end
commit
.
refs
=
ref_cache
[
commit
.
id
]
if
ref_cache
.
include?
commit
.
id
commit
.
refs
=
ref_cache
[
commit
.
id
]
if
ref_cache
.
include?
commit
.
id
commit
.
refs
||=
[]
commit
.
refs
||=
[]
...
...
lib/graph_commit.rb
View file @
dc844f01
...
@@ -25,7 +25,7 @@ class GraphCommit
...
@@ -25,7 +25,7 @@ class GraphCommit
commits
.
reverse
.
each_with_index
do
|
c
,
i
|
commits
.
reverse
.
each_with_index
do
|
c
,
i
|
c
.
time
=
i
c
.
time
=
i
days
[
i
]
=
c
.
committed_date
days
[
i
]
=
c
.
committed_date
map
[
c
.
id
]
=
c
map
[
c
.
id
]
=
c
heads
+=
c
.
refs
unless
c
.
refs
.
nil?
heads
+=
c
.
refs
unless
c
.
refs
.
nil?
end
end
...
@@ -63,7 +63,7 @@ class GraphCommit
...
@@ -63,7 +63,7 @@ class GraphCommit
m1
=
mark
-
1
m1
=
mark
-
1
marks
=
commit
.
parents
.
collect
do
|
p
|
marks
=
commit
.
parents
.
collect
do
|
p
|
if
map
.
include?
p
.
id
and
map
[
p
.
id
].
space
==
0
then
if
map
.
include?
p
.
id
and
map
[
p
.
id
].
space
==
0
then
mark_chain
(
m1
+=
1
,
map
[
p
.
id
],
map
)
mark_chain
(
m1
+=
1
,
map
[
p
.
id
],
map
)
else
else
m1
+
1
m1
+
1
end
end
...
@@ -72,11 +72,4 @@ class GraphCommit
...
@@ -72,11 +72,4 @@ class GraphCommit
marks
.
compact
.
max
marks
.
compact
.
max
end
end
def
self
.
add_refs
(
commit
,
ref_cache
)
if
ref_cache
.
empty?
@repo
.
refs
.
each
{
|
ref
|
ref_cache
[
ref
.
commit
.
id
]
||=
[];
ref_cache
[
ref
.
commit
.
id
]
<<
ref
}
end
commit
.
refs
=
ref_cache
[
commit
.
id
]
if
ref_cache
.
include?
commit
.
id
commit
.
refs
||=
[]
end
end
end
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