scm: git: move saving changesets from adapter to model (#3396).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4959 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
c781cbb2f7
commit
d7aa303a5c
|
@ -79,7 +79,28 @@ class Repository::Git < Repository
|
|||
revisions.reject!{|r| recent_revisions.include?(r.scmid)}
|
||||
|
||||
# Save the remaining ones to the database
|
||||
revisions.each{|r| r.save(self)} unless revisions.nil?
|
||||
unless revisions.nil?
|
||||
revisions.each do |rev|
|
||||
transaction do
|
||||
changeset = Changeset.new(
|
||||
:repository => self,
|
||||
:revision => rev.identifier,
|
||||
:scmid => rev.scmid,
|
||||
:committer => rev.author,
|
||||
:committed_on => rev.time,
|
||||
:comments => rev.message)
|
||||
|
||||
if changeset.save
|
||||
rev.paths.each do |file|
|
||||
Change.create(
|
||||
:changeset => changeset,
|
||||
:action => file[:action],
|
||||
:path => file[:path])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def latest_changesets(path,rev,limit=10)
|
||||
|
|
|
@ -324,27 +324,6 @@ module Redmine
|
|||
def format_identifier
|
||||
identifier
|
||||
end
|
||||
|
||||
def save(repo)
|
||||
Changeset.transaction do
|
||||
changeset = Changeset.new(
|
||||
:repository => repo,
|
||||
:revision => identifier,
|
||||
:scmid => scmid,
|
||||
:committer => author,
|
||||
:committed_on => time,
|
||||
:comments => message)
|
||||
|
||||
if changeset.save
|
||||
paths.each do |file|
|
||||
Change.create(
|
||||
:changeset => changeset,
|
||||
:action => file[:action],
|
||||
:path => file[:path])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class Annotate
|
||||
|
|
Loading…
Reference in New Issue