]> source.dussan.org Git - redmine.git/commitdiff
scm: git: model: save parent/child relation for changesets (#5501)
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 3 Nov 2011 08:02:22 +0000 (08:02 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 3 Nov 2011 08:02:22 +0000 (08:02 +0000)
Contributed by Jan TopiƄski.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7711 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/repository/git.rb

index 401647948d68f68256bb911c6ff7ad50a8dd4770..cd2a5768dd01252297c3fc235ade7c9e13a08b03 100644 (file)
@@ -149,7 +149,12 @@ class Repository::Git < Repository
         db_rev = find_changeset_by_name(rev.revision)
         transaction do
           if db_rev.nil?
-            save_revision(rev)
+            db_saved_rev = save_revision(rev)
+            parents = {}
+            parents[db_saved_rev] = rev.parents unless rev.parents.nil?
+            parents.each do |ch, chparents|
+              ch.parents = chparents.collect{|rp| find_changeset_by_name(rp)}.compact
+            end
           end
           h["branches"][br]["last_scmid"] = rev.scmid
           merge_extra_info(h)