Project

General

Profile

Feature #339 » perforce_bulk_load.patch

George Gensure, 2009-04-20 22:29

View differences:

app/models/repository/perforce.rb 2009-04-20 10:28:09.956752000 -0400
if db_revision < scm_revision
logger.debug "Fetching changesets for repository #{url}" if logger && logger.debug?
identifier_from = db_revision + 1
while (identifier_from <= scm_revision)
# loads changesets by batches of 200
identifier_to = [identifier_from + 199, scm_revision].min
revisions = scm.revisions('', identifier_to, identifier_from, :with_paths => true)
transaction do
revisions.reverse_each do
|revision|
changeset = Changeset.create(:repository => self,
:revision => revision.identifier,
:committer => revision.author,
:committed_on => revision.time,
:comments => revision.message)
revision.paths.each do
|change|
identifier_to = scm_revision
revisions = scm.revisions('', identifier_to, identifier_from, :with_paths => true)
transaction do
revisions.reverse_each do
|revision|
changeset = Changeset.create(:repository => self,
:revision => revision.identifier,
:committer => revision.author,
:committed_on => revision.time,
:comments => revision.message)
revision.paths.each do
|change|
revpath = '/' + scm.relative_path( change.depot_file )
action = ( change.action )
revaction = case action
when "add" then "A"
when "delete" then "D"
when "edit" then "M"
when "branch" then "B"
#when "integrate" then "I"
#when "import" then "E"
end
Change.create(:changeset => changeset,
:action => revaction,
:path => revpath,
:revision => '#' + ( change.revno.to_s + '/' + change.head.to_s ))
revpath = '/' + scm.relative_path( change.depot_file )
action = ( change.action )
revaction = case action
when "add" then "A"
when "delete" then "D"
when "edit" then "M"
when "branch" then "B"
#when "integrate" then "I"
#when "import" then "E"
end
Change.create(:changeset => changeset,
:action => revaction,
:path => revpath,
:revision => '#' + ( change.revno.to_s + '/' + change.head.to_s ))
end
end unless revisions.nil?
identifier_from = identifier_to + 1
end
end
end unless revisions.nil?
end
end
end
(4-4/11)