summaryrefslogtreecommitdiffstats
path: root/app/models/repository
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-03-29 16:50:10 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-03-29 16:50:10 +0000
commitb2a2cb68dd322112ef4233e7575b0883f405c7be (patch)
tree6a7e3a67ae17dae59a87af54fd768b0c46793001 /app/models/repository
parent76435033e7a15f01085c947ea219a8a8b41af19d (diff)
downloadredmine-b2a2cb68dd322112ef4233e7575b0883f405c7be.tar.gz
redmine-b2a2cb68dd322112ef4233e7575b0883f405c7be.zip
scm: mercurial: transaction for each imported revisions (#10470)
Subversion transaction switched at r2563. Subversion and Mercurial have a sequential revision number. So, Mercurial can use the same logic with Subversion. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9288 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/repository')
-rw-r--r--app/models/repository/mercurial.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/app/models/repository/mercurial.rb b/app/models/repository/mercurial.rb
index b2ee18445..c31682783 100644
--- a/app/models/repository/mercurial.rb
+++ b/app/models/repository/mercurial.rb
@@ -138,19 +138,21 @@ class Repository::Mercurial < Repository
logger.debug "Fetching changesets for repository #{url}" if logger
(db_rev + 1).step(scm_rev, FETCH_AT_ONCE) do |i|
- transaction do
- scm.each_revision('', i, [i + FETCH_AT_ONCE - 1, scm_rev].min) do |re|
+ scm.each_revision('', i, [i + FETCH_AT_ONCE - 1, scm_rev].min) do |re|
+ transaction do
cs = Changeset.create(:repository => self,
:revision => re.revision,
:scmid => re.scmid,
:committer => re.author,
:committed_on => re.time,
:comments => re.message)
- re.paths.each { |e| cs.create_change(e) }
- parents = {}
- parents[cs] = re.parents unless re.parents.nil?
- parents.each do |ch, chparents|
- ch.parents = chparents.collect{|rp| find_changeset_by_name(rp)}.compact
+ unless cs.new_record?
+ re.paths.each { |e| cs.create_change(e) }
+ parents = {}
+ parents[cs] = re.parents unless re.parents.nil?
+ parents.each do |ch, chparents|
+ ch.parents = chparents.collect{|rp| find_changeset_by_name(rp)}.compact
+ end
end
end
end