Mercurial > hg > soundsoftware-site
comparison app/models/changeset.rb @ 929:5f33065ddc4b redmine-1.3
Update to Redmine SVN rev 9414 on 1.3-stable branch
author | Chris Cannam |
---|---|
date | Wed, 27 Jun 2012 14:54:18 +0100 |
parents | cbb26bc654de |
children | ec1c49528f36 433d4f72a19b |
comparison
equal
deleted
inserted
replaced
909:cbb26bc654de | 929:5f33065ddc4b |
---|---|
149 | 149 |
150 def long_comments | 150 def long_comments |
151 @long_comments || split_comments.last | 151 @long_comments || split_comments.last |
152 end | 152 end |
153 | 153 |
154 def text_tag | 154 def text_tag(ref_project=nil) |
155 if scmid? | 155 tag = if scmid? |
156 "commit:#{scmid}" | 156 "commit:#{scmid}" |
157 else | 157 else |
158 "r#{revision}" | 158 "r#{revision}" |
159 end | 159 end |
160 if ref_project && project && ref_project != project | |
161 tag = "#{project.identifier}:#{tag}" | |
162 end | |
163 tag | |
160 end | 164 end |
161 | 165 |
162 # Returns the previous changeset | 166 # Returns the previous changeset |
163 def previous | 167 def previous |
164 @previous ||= Changeset.find(:first, | 168 @previous ||= Changeset.find(:first, |
211 # the issue may have been updated by the closure of another one (eg. duplicate) | 215 # the issue may have been updated by the closure of another one (eg. duplicate) |
212 issue.reload | 216 issue.reload |
213 # don't change the status is the issue is closed | 217 # don't change the status is the issue is closed |
214 return if issue.status && issue.status.is_closed? | 218 return if issue.status && issue.status.is_closed? |
215 | 219 |
216 journal = issue.init_journal(user || User.anonymous, ll(Setting.default_language, :text_status_changed_by_changeset, text_tag)) | 220 journal = issue.init_journal(user || User.anonymous, ll(Setting.default_language, :text_status_changed_by_changeset, text_tag(issue.project))) |
217 issue.status = status | 221 issue.status = status |
218 unless Setting.commit_fix_done_ratio.blank? | 222 unless Setting.commit_fix_done_ratio.blank? |
219 issue.done_ratio = Setting.commit_fix_done_ratio.to_i | 223 issue.done_ratio = Setting.commit_fix_done_ratio.to_i |
220 end | 224 end |
221 Redmine::Hook.call_hook(:model_changeset_scan_commit_for_issue_ids_pre_issue_update, | 225 Redmine::Hook.call_hook(:model_changeset_scan_commit_for_issue_ids_pre_issue_update, |
230 time_entry = TimeEntry.new( | 234 time_entry = TimeEntry.new( |
231 :user => user, | 235 :user => user, |
232 :hours => hours, | 236 :hours => hours, |
233 :issue => issue, | 237 :issue => issue, |
234 :spent_on => commit_date, | 238 :spent_on => commit_date, |
235 :comments => l(:text_time_logged_by_changeset, :value => text_tag, | 239 :comments => l(:text_time_logged_by_changeset, :value => text_tag(issue.project), |
236 :locale => Setting.default_language) | 240 :locale => Setting.default_language) |
237 ) | 241 ) |
238 time_entry.activity = log_time_activity unless log_time_activity.nil? | 242 time_entry.activity = log_time_activity unless log_time_activity.nil? |
239 | 243 |
240 unless time_entry.save | 244 unless time_entry.save |