scm: git: reduce saving heads times in fetching revisions (#8857, #9472)

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8840 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2012-02-11 05:42:43 +00:00
parent 1e5f16722f
commit 165327a074
1 changed files with 7 additions and 2 deletions

View File

@ -162,10 +162,12 @@ class Repository::Git < Repository
opts[:excludes] = prev_db_heads
opts[:includes] = repo_heads
begin
cnt = 0
scm.revisions('', nil, nil, opts) do |rev|
cnt += 1
db_rev = find_changeset_by_name(rev.scmid)
transaction do
if db_rev.nil?
transaction do
db_saved_rev = save_revision(rev)
parents = {}
parents[db_saved_rev] = rev.parents unless rev.parents.nil?
@ -173,6 +175,9 @@ class Repository::Git < Repository
ch.parents = chparents.collect{|rp| find_changeset_by_name(rp)}.compact
end
end
end
if cnt > 100
cnt = 0
h["heads"] = prev_db_heads.dup
h["heads"] << rev.scmid
merge_extra_info(h)