]> source.dussan.org Git - redmine.git/commitdiff
scm: git: move saving changesets from adapter to model (#3396).
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Mon, 28 Feb 2011 04:46:42 +0000 (04:46 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Mon, 28 Feb 2011 04:46:42 +0000 (04:46 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4959 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/repository/git.rb
lib/redmine/scm/adapters/abstract_adapter.rb

index 8fb6325b0be287dae87e5c95fb5fd658064d829f..0ebd8668e0adc2d463ac1425749a4bb4dc873b28 100644 (file)
@@ -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)
index 3f9bc0ef1002bd2758ecef974b599f45df3de437..039513aa90b385ad35e1b20d5a7098dc20d3b6df 100644 (file)
@@ -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