Feature #4155 » logtime_redmine_0.9.3_v2.3.patch
| app/models/changeset.rb (working copy) | ||
|---|---|---|
|
|
||
|
referenced_issues = []
|
||
|
|
||
|
log_time = []
|
||
|
logger.debug "Changeset comment: #{comments}" if logger && logger.debug?
|
||
|
if ref_keywords.delete('*')
|
||
|
# find any issue ID in the comments
|
||
|
target_issue_ids = []
|
||
|
comments.scan(%r{([\s\(\[,-]|^)#(\d+)(?=[[:punct:]]|\s|<|$)}).each { |m| target_issue_ids << m[1] }
|
||
|
comments.scan(%r{([\s\(\[,-]|^)#(\d+)([\s]*@(\d+[.]\d+|(\d+[hm]\s?){1,2}))?(?=[[:punct:]]|\s|<|$)}).each do |m|
|
||
|
target_issue_ids << m[1]
|
||
|
log_time << [m[1], (m[2] != nil ? m[2].scan(/(\d+[.]\d+|(\d+[hm]\s?){1,2})/)[0][0] : 0)]
|
||
|
end
|
||
|
referenced_issues += find_referenced_issues_by_id(target_issue_ids)
|
||
|
end
|
||
|
|
||
|
comments.scan(Regexp.new("(#{kw_regexp})[\s:]+(([\s,;&]*#?\\d+)+)", Regexp::IGNORECASE)).each do |match|
|
||
|
comments.scan(Regexp.new("(#{kw_regexp})[\s:]+((([\s,;&]*([^@]|#?)\\d+)([\s]*@(\\d+[.]\\d+|(\\d+[hm]\s?){1,2}))?)+)", Regexp::IGNORECASE)).each do |match|
|
||
|
action = match[0]
|
||
|
target_issue_ids = match[1].scan(/\d+/)
|
||
|
|
||
|
target_issues_with_log = match[1].scan(/([\s,;&]*([^@]|#?)\d+)([\s]*@(\d+[.]\d+|(\d+[hm]\s?){1,2}))?/)
|
||
|
target_issues_with_log.collect! { |x| [ x[0].scan(/\d+/)[0], (x[2] != nil ? x[3].scan(/(\d+[.]\d+|(\d+[hm]\s?){1,2})/)[0][0] : 0) ] }
|
||
|
log_time += target_issues_with_log
|
||
|
|
||
|
target_issue_ids = target_issues_with_log.collect {|x| x[0]}
|
||
|
|
||
|
target_issues = find_referenced_issues_by_id(target_issue_ids)
|
||
|
if fix_keywords.include?(action.downcase) && fix_status = IssueStatus.find_by_id(Setting.commit_fix_status_id)
|
||
|
# update status of issues
|
||
|
logger.debug "Issues fixed by changeset #{self.revision}: #{issue_ids.join(', ')}." if logger && logger.debug?
|
||
|
logger.debug "Issues fixed by changeset #{self.revision}: #{target_issue_ids.join(', ')}." if logger && logger.debug?
|
||
|
target_issues.each do |issue|
|
||
|
# the issue may have been updated by the closure of another one (eg. duplicate)
|
||
|
issue.reload
|
||
| ... | ... | |
|
issue.save
|
||
|
end
|
||
|
end
|
||
|
|
||
|
referenced_issues += target_issues
|
||
|
end
|
||
|
if Setting.commit_logtime_enabled?
|
||
|
log_time.uniq.each do |issue_wl|
|
||
|
next if issue_wl[1] == nil || issue_wl[1] == 0
|
||
|
issue_id = issue_wl[0]
|
||
|
issue_hours = issue_wl[1]
|
||
|
match = issue_hours.match(/\d+[.]\d+/)
|
||
|
if match != nil
|
||
|
issue_hours = match[0].to_f
|
||
|
else
|
||
|
hours = ((match = issue_hours.scan(/(\d+)h/)).size == 1 ? match[0][0] : 0)
|
||
|
minutes = ((match = issue_hours.scan(/(\d+)m/)).size == 1 ? match[0][0] : 0)
|
||
|
hours = (hours == nil ? 0 : hours.to_i)
|
||
|
minutes = (minutes == nil ? 0 : minutes.to_i)
|
||
|
issue_hours = ((hours.to_f + minutes.to_f / 60.0) * 100.0).round / 100.0
|
||
|
end
|
||
|
next if issue_hours.to_f <= 0
|
||
|
logger.debug "Log time for issue #{issue_id} - #{issue_hours}." if logger && logger.debug?
|
||
|
issue = Issue.find_by_id(issue_id)
|
||
|
activity = TimeEntryActivity.default
|
||
|
if activity == nil
|
||
|
activity = TimeEntryActivity.find(:first)
|
||
|
end
|
||
|
next if activity == nil || issue == nil || user == nil
|
||
|
csettext = "from revision r#{self.revision}"
|
||
|
if self.scmid && (! (csettext =~ /^r[0-9]+$/))
|
||
|
csettext = "from revision \"#{self.scmid}\""
|
||
|
end
|
||
|
timeentry = TimeEntry.create(:project => issue.project,
|
||
|
:issue => issue,
|
||
|
:user => user,
|
||
|
:spent_on => self.commit_date,
|
||
|
:hours => issue_hours,
|
||
|
:activity_id => activity.id,
|
||
|
:comments => csettext)
|
||
|
timeentry.save
|
||
|
end
|
||
|
end
|
||
|
|
||
|
referenced_issues.uniq!
|
||
|
self.issues = referenced_issues unless referenced_issues.empty?
|
||
| app/views/settings/_repositories.rhtml (working copy) | ||
|---|---|---|
|
<%= l(:label_applied_status) %>: <%= setting_select :commit_fix_status_id, [["", 0]] + IssueStatus.find(:all).collect{|status| [status.name, status.id.to_s]}, :label => false %>
|
||
|
<%= l(:field_done_ratio) %>: <%= setting_select :commit_fix_done_ratio, (0..10).to_a.collect {|r| ["#{r*10} %", "#{r*10}"] }, :blank => :label_no_change_option, :label => false %>
|
||
|
<br /><em><%= l(:text_comma_separated) %></em></p>
|
||
|
<p><label><%= l(:setting_commit_logtime_enabled) %></label>
|
||
|
<%= hidden_field_tag 'settings[commit_logtime_enabled]', 0 %><%= check_box_tag 'settings[commit_logtime_enabled]', 1, Setting.commit_logtime_enabled? %>
|
||
|
<br /><em><%= l(:text_commit_logtime) %></em></p>
|
||
|
</fieldset>
|
||
|
<%= submit_tag l(:button_save) %>
|
||
| config/settings.yml (working copy) | ||
|---|---|---|
|
default: 0
|
||
|
commit_fix_done_ratio:
|
||
|
default: 100
|
||
|
commit_logtime_enabled:
|
||
|
format: int
|
||
|
default: 0
|
||
|
# autologin duration in days
|
||
|
# 0 means autologin is disabled
|
||
|
autologin:
|
||
| config/locales/ro.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/zh.yml (working copy) | ||
|---|---|---|
|
permission_view_issue_watchers: 查看跟踪者列表
|
||
|
permission_add_issue_watchers: 添加跟踪者
|
||
|
permission_delete_issue_watchers: 删除跟踪者
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
permission_log_time: 登记工时
|
||
|
permission_view_time_entries: 查看耗时
|
||
|
permission_edit_time_entries: 编辑耗时
|
||
| config/locales/pt.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/ca.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/tr.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/el.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/en.yml (working copy) | ||
|---|---|---|
|
enumeration_doc_categories: Document categories
|
||
|
enumeration_activities: Activities (time tracking)
|
||
|
enumeration_system_activity: System Activity
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
| config/locales/gl.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/cs.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/it.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/sk.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/sl.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/uk.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/da.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/sr.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/bg.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/he.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/fi.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/bs.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/fr.yml (working copy) | ||
|---|---|---|
|
text_journal_deleted: "{{label}} {{old}} supprimé"
|
||
|
text_journal_added: "{{label}} {{value}} ajouté"
|
||
|
enumeration_system_activity: Activité système
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
label_board_sticky: Sticky
|
||
|
label_board_locked: Verrouillé
|
||
| config/locales/hr.yml (working copy) | ||
|---|---|---|
|
permission_view_issue_watchers: Pregledaj listu promatraca
|
||
|
permission_add_issue_watchers: Dodaj promatrača
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
permission_log_time: Dnevnik utrošenog vremena
|
||
|
permission_view_time_entries: Pregledaj utrošeno vrijeme
|
||
|
permission_edit_time_entries: Uredi vremenske dnevnike
|
||
| config/locales/nl.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/th.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/no.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/hu.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||
| config/locales/vi.yml (working copy) | ||
|---|---|---|
|
field_active: Active
|
||
|
enumeration_system_activity: System Activity
|
||
|
permission_delete_issue_watchers: Delete watchers
|
||
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
text_commit_logtime: "Allows to log time in commit messages. Examples: refs #123 @1.5 or refs #123 @1h30m or fixes #123 @1h 30m (logs one hour and 30 minutes for issue #123)"
|
||
|
version_status_closed: closed
|
||
|
version_status_locked: locked
|
||
|
version_status_open: open
|
||