summaryrefslogtreecommitdiffstats
path: root/app/helpers/repositories_helper.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-09-15 15:08:28 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-09-15 15:08:28 +0000
commit5441f8de4df54b0e7e65e52b02511e4ecf155913 (patch)
treed0174d955bf93c2751383f0f6321112649a12ec2 /app/helpers/repositories_helper.rb
parente659aff468ad86df8db6cdcb213f628465a9ea22 (diff)
downloadredmine-5441f8de4df54b0e7e65e52b02511e4ecf155913.tar.gz
redmine-5441f8de4df54b0e7e65e52b02511e4ecf155913.zip
remove redundant empty lines from RepositoriesHelper
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10382 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/repositories_helper.rb')
-rw-r--r--app/helpers/repositories_helper.rb13
1 files changed, 0 insertions, 13 deletions
diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb
index 938ce12b2..8c0909388 100644
--- a/app/helpers/repositories_helper.rb
+++ b/app/helpers/repositories_helper.rb
@@ -252,16 +252,13 @@ module RepositoriesHelper
def index_commits(commits, heads)
return nil if commits.nil? or commits.first.parents.nil?
-
refs_map = {}
heads.each do |head|
refs_map[head.scmid] ||= []
refs_map[head.scmid] << head
end
-
commits_by_scmid = {}
commits.reverse.each_with_index do |commit, commit_index|
-
commits_by_scmid[commit.scmid] = {
:parent_scmids => commit.parents.collect { |parent| parent.scmid },
:rdmid => commit_index,
@@ -270,38 +267,28 @@ module RepositoriesHelper
:href => block_given? ? yield(commit.scmid) : commit.scmid
}
end
-
heads.sort! { |head1, head2| head1.to_s <=> head2.to_s }
-
space = nil
heads.each do |head|
if commits_by_scmid.include? head.scmid
space = index_head((space || -1) + 1, head, commits_by_scmid)
end
end
-
# when no head matched anything use first commit
space ||= index_head(0, commits.first, commits_by_scmid)
-
return commits_by_scmid, space
end
def index_head(space, commit, commits_by_scmid)
-
stack = [[space, commits_by_scmid[commit.scmid]]]
max_space = space
-
until stack.empty?
space, commit = stack.pop
commit[:space] = space if commit[:space].nil?
-
space -= 1
commit[:parent_scmids].each_with_index do |parent_scmid, parent_index|
-
parent_commit = commits_by_scmid[parent_scmid]
-
if parent_commit and parent_commit[:space].nil?
-
stack.unshift [space += 1, parent_commit]
end
end