##// END OF EJS Templates
Wraps changeset creation inside a single transation....
Jean-Philippe Lang -
r3355:103698b371ee
parent child
Show More
@@ -286,21 +286,23 module Redmine
286 end
286 end
287
287
288 def save(repo)
288 def save(repo)
289 if repo.changesets.find_by_scmid(scmid.to_s).nil?
289 Changeset.transaction do
290 changeset = Changeset.create!(
290 changeset = Changeset.new(
291 :repository => repo,
291 :repository => repo,
292 :revision => identifier,
292 :revision => identifier,
293 :scmid => scmid,
293 :scmid => scmid,
294 :committer => author,
294 :committer => author,
295 :committed_on => time,
295 :committed_on => time,
296 :comments => message)
296 :comments => message)
297
297
298 paths.each do |file|
298 if changeset.save
299 Change.create!(
299 paths.each do |file|
300 :changeset => changeset,
300 Change.create(
301 :action => file[:action],
301 :changeset => changeset,
302 :path => file[:path])
302 :action => file[:action],
303 end
303 :path => file[:path])
304 end
305 end
304 end
306 end
305 end
307 end
306 end
308 end
General Comments 0
You need to be logged in to leave comments. Login now