summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-03-29 22:41:20 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-03-29 22:41:20 +0000
commitf36eb54141c67f8d33a741182d5754ebec77d391 (patch)
tree709d45839c2064a7a1bc5b883da7bd830ea7c76d /app
parentcdb7ea8b916ef52d9060574da12ac4037bef9492 (diff)
downloadredmine-f36eb54141c67f8d33a741182d5754ebec77d391.tar.gz
redmine-f36eb54141c67f8d33a741182d5754ebec77d391.zip
scm: git: use Changeset#create and Changeset#create_change as same with Subversion and Mercurial
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9290 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/repository/git.rb21
1 files changed, 8 insertions, 13 deletions
diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb
index b048c0f65..37104cbf0 100644
--- a/app/models/repository/git.rb
+++ b/app/models/repository/git.rb
@@ -208,12 +208,7 @@ class Repository::Git < Repository
transaction do
# There is no search in the db for this revision, because above we ensured,
# that it's not in the db.
- 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
+ save_revision(rev)
end
end
h["heads"] = repo_heads.dup
@@ -223,7 +218,7 @@ class Repository::Git < Repository
private :save_revisions
def save_revision(rev)
- changeset = Changeset.new(
+ changeset = Changeset.create(
:repository => self,
:revision => rev.identifier,
:scmid => rev.scmid,
@@ -231,12 +226,12 @@ class Repository::Git < Repository
: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])
+ unless changeset.new_record?
+ rev.paths.each { |change| changeset.create_change(change) }
+ parents = {}
+ parents[changeset] = rev.parents unless rev.parents.nil?
+ parents.each do |ch, chparents|
+ ch.parents = chparents.collect{|rp| find_changeset_by_name(rp)}.compact
end
end
changeset