comparison app/models/repository/cvs.rb @ 1464:261b3d9a4903 redmine-2.4

Update to Redmine 2.4 branch rev 12663
author Chris Cannam
date Tue, 14 Jan 2014 14:37:42 +0000
parents 433d4f72a19b
children 51364c0cd58f e248c7af89ec
comparison
equal deleted inserted replaced
1296:038ba2d95de8 1464:261b3d9a4903
1 # Redmine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang 2 # Copyright (C) 2006-2013 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
141 scm.with_leading_slash(revision.paths[0][:path]), 141 scm.with_leading_slash(revision.paths[0][:path]),
142 revision.paths[0][:revision] 142 revision.paths[0][:revision]
143 ) 143 )
144 cmt = Changeset.normalize_comments(revision.message, repo_log_encoding) 144 cmt = Changeset.normalize_comments(revision.message, repo_log_encoding)
145 author_utf8 = Changeset.to_utf8(revision.author, repo_log_encoding) 145 author_utf8 = Changeset.to_utf8(revision.author, repo_log_encoding)
146 cs = changesets.find( 146 cs = changesets.where(
147 :first, 147 :committed_on => tmp_time - time_delta .. tmp_time + time_delta,
148 :conditions => { 148 :committer => author_utf8,
149 :committed_on => tmp_time - time_delta .. tmp_time + time_delta, 149 :comments => cmt
150 :committer => author_utf8, 150 ).first
151 :comments => cmt
152 }
153 )
154 # create a new changeset.... 151 # create a new changeset....
155 unless cs 152 unless cs
156 # we use a temporaray revision number here (just for inserting) 153 # we use a temporaray revision number here (just for inserting)
157 # later on, we calculate a continous positive number 154 # later on, we calculate a continous positive number
158 tmp_time2 = tmp_time.clone.gmtime 155 tmp_time2 = tmp_time.clone.gmtime
183 ) 180 )
184 end 181 end
185 end 182 end
186 183
187 # Renumber new changesets in chronological order 184 # Renumber new changesets in chronological order
188 Changeset.all( 185 Changeset.
189 :order => 'committed_on ASC, id ASC', 186 order('committed_on ASC, id ASC').
190 :conditions => ["repository_id = ? AND revision LIKE 'tmp%'", id] 187 where("repository_id = ? AND revision LIKE 'tmp%'", id).
191 ).each do |changeset| 188 each do |changeset|
192 changeset.update_attribute :revision, next_revision_number 189 changeset.update_attribute :revision, next_revision_number
193 end 190 end
194 end # transaction 191 end # transaction
195 @current_revision_number = nil 192 @current_revision_number = nil
196 end 193 end