summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-02-21 14:38:34 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-02-21 14:38:34 +0000
commit103698b371ee139b2f037b7ab3483a82c732b914 (patch)
treeb2212de70be7d3b0bce27138a577436da8fc82f1 /lib
parent87bc092d7cac1c1a1fd686d96fa540ddab97622c (diff)
downloadredmine-103698b371ee139b2f037b7ab3483a82c732b914.tar.gz
redmine-103698b371ee139b2f037b7ab3483a82c732b914.zip
Wraps changeset creation inside a single transation.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3469 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/scm/adapters/abstract_adapter.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/redmine/scm/adapters/abstract_adapter.rb b/lib/redmine/scm/adapters/abstract_adapter.rb
index 962072950..a3ca61e23 100644
--- a/lib/redmine/scm/adapters/abstract_adapter.rb
+++ b/lib/redmine/scm/adapters/abstract_adapter.rb
@@ -286,21 +286,23 @@ module Redmine
end
def save(repo)
- if repo.changesets.find_by_scmid(scmid.to_s).nil?
- changeset = Changeset.create!(
+ Changeset.transaction do
+ changeset = Changeset.new(
:repository => repo,
:revision => identifier,
:scmid => scmid,
:committer => author,
:committed_on => time,
:comments => message)
-
- paths.each do |file|
- Change.create!(
- :changeset => changeset,
- :action => file[:action],
- :path => file[:path])
- end
+
+ if changeset.save
+ paths.each do |file|
+ Change.create(
+ :changeset => changeset,
+ :action => file[:action],
+ :path => file[:path])
+ end
+ end
end
end
end