Patch #7445 » commit-update-1.1.0.patch
| redmine-1.1.0-commit-update/app/models/changeset.rb 2011-01-25 17:57:11.871370800 -0700 | ||
|---|---|---|
| 110 | 110 |
# keywords used to reference issues |
| 111 | 111 |
ref_keywords = Setting.commit_ref_keywords.downcase.split(",").collect(&:strip)
|
| 112 | 112 |
ref_keywords_any = ref_keywords.delete('*')
|
| 113 |
# keywords used to fix issues |
|
| 114 |
fix_keywords = Setting.commit_fix_keywords.downcase.split(",").collect(&:strip)
|
|
| 115 |
|
|
| 116 |
kw_regexp = (ref_keywords + fix_keywords).collect{|kw| Regexp.escape(kw)}.join("|")
|
|
| 113 |
|
|
| 114 |
ref_updates = |
|
| 115 |
[ { :keywords => Setting.commit_update1_keywords.downcase.split(",").collect(&:strip),
|
|
| 116 |
:status_id => Setting.commit_update1_status_id, |
|
| 117 |
:done_ratio => Setting.commit_update1_done_ratio }, |
|
| 118 |
{ :keywords => Setting.commit_update2_keywords.downcase.split(",").collect(&:strip),
|
|
| 119 |
:status_id => Setting.commit_update2_status_id, |
|
| 120 |
:done_ratio => Setting.commit_update2_done_ratio }, |
|
| 121 |
{ :keywords => Setting.commit_update3_keywords.downcase.split(",").collect(&:strip),
|
|
| 122 |
:status_id => Setting.commit_update3_status_id, |
|
| 123 |
:done_ratio => Setting.commit_update3_done_ratio }, |
|
| 124 |
{ :keywords => Setting.commit_update4_keywords.downcase.split(",").collect(&:strip),
|
|
| 125 |
:status_id => Setting.commit_update4_status_id, |
|
| 126 |
:done_ratio => Setting.commit_update4_done_ratio }, |
|
| 127 |
{ :keywords => Setting.commit_update5_keywords.downcase.split(",").collect(&:strip),
|
|
| 128 |
:status_id => Setting.commit_update5_status_id, |
|
| 129 |
:done_ratio => Setting.commit_update5_done_ratio } ] |
|
| 130 |
|
|
| 131 |
kw_regexp = (ref_keywords + ref_updates.collect{|u| u[:keywords]}.flatten).collect{|kw| Regexp.escape(kw)}.join("|")
|
|
| 117 | 132 |
|
| 118 | 133 |
referenced_issues = [] |
| 119 | 134 |
|
| ... | ... | |
| 124 | 139 |
refs.scan(/#(\d+)(\s+@#{TIMELOG_RE})?/).each do |m|
|
| 125 | 140 |
issue, hours = find_referenced_issue_by_id(m[0].to_i), m[2] |
| 126 | 141 |
if issue |
| 127 |
referenced_issues << issue |
|
| 128 |
fix_issue(issue) if fix_keywords.include?(action.to_s.downcase) |
|
| 142 |
referenced_issues << issue |
|
| 143 |
ref_updates.each do |u| |
|
| 144 |
update_issue(issue, u[:status_id], u[:done_ratio]) if u[:keywords].include?(action.to_s.downcase) |
|
| 145 |
end |
|
| 129 | 146 |
log_time(issue, hours) if hours && Setting.commit_logtime_enabled? |
| 130 | 147 |
end |
| 131 | 148 |
end |
| ... | ... | |
| 190 | 207 |
issue |
| 191 | 208 |
end |
| 192 | 209 |
|
| 193 |
def fix_issue(issue)
|
|
| 194 |
status = IssueStatus.find_by_id(Setting.commit_fix_status_id.to_i)
|
|
| 210 |
def update_issue(issue, status_id, done_ratio)
|
|
| 211 |
status = IssueStatus.find_by_id(status_id.to_i) |
|
| 195 | 212 |
if status.nil? |
| 196 |
logger.warn("No status macthes commit_fix_status_id setting (#{Setting.commit_fix_status_id})") if logger
|
|
| 213 |
logger.warn("No status macthes commit_update_status_id setting (#{status_id})") if logger
|
|
| 197 | 214 |
return issue |
| 198 | 215 |
end |
| 199 | 216 |
|
| ... | ... | |
| 204 | 221 |
|
| 205 | 222 |
journal = issue.init_journal(user || User.anonymous, ll(Setting.default_language, :text_status_changed_by_changeset, text_tag)) |
| 206 | 223 |
issue.status = status |
| 207 |
unless Setting.commit_fix_done_ratio.blank?
|
|
| 208 |
issue.done_ratio = Setting.commit_fix_done_ratio.to_i
|
|
| 224 |
unless done_ratio.blank? |
|
| 225 |
issue.done_ratio = done_ratio.to_i |
|
| 209 | 226 |
end |
| 210 | 227 |
Redmine::Hook.call_hook(:model_changeset_scan_commit_for_issue_ids_pre_issue_update, |
| 211 | 228 |
{ :changeset => self, :issue => issue })
|
| redmine-1.1.0-commit-update/app/views/settings/_repositories.rhtml 2011-01-25 17:05:58.109793000 -0700 | ||
|---|---|---|
| 27 | 27 |
<p><%= setting_text_field :commit_ref_keywords, :size => 30 %><br /> |
| 28 | 28 |
<em><%= l(:text_comma_separated) %></em></p> |
| 29 | 29 |
|
| 30 |
<p><%= setting_text_field :commit_fix_keywords, :size => 30 %> |
|
| 31 |
<%= l(:label_applied_status) %>: <%= setting_select :commit_fix_status_id, [["", 0]] + IssueStatus.find(:all).collect{|status| [status.name, status.id.to_s]}, :label => false %>
|
|
| 32 |
<%= 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 %>
|
|
| 30 |
<p><%= setting_text_field :commit_update1_keywords, :size => 30 %> |
|
| 31 |
<%= l(:label_applied_status) %>: <%= setting_select :commit_update1_status_id, [["", 0]] + IssueStatus.find(:all).collect{|status| [status.name, status.id.to_s]}, :label => false %>
|
|
| 32 |
<%= l(:field_done_ratio) %>: <%= setting_select :commit_update1_done_ratio, (0..10).to_a.collect {|r| ["#{r*10} %", "#{r*10}"] }, :blank => :label_no_change_option, :label => false %>
|
|
| 33 |
<br /><em><%= l(:text_comma_separated) %></em></p> |
|
| 34 |
|
|
| 35 |
<p><%= setting_text_field :commit_update2_keywords, :size => 30 %> |
|
| 36 |
<%= l(:label_applied_status) %>: <%= setting_select :commit_update2_status_id, [["", 0]] + IssueStatus.find(:all).collect{|status| [status.name, status.id.to_s]}, :label => false %>
|
|
| 37 |
<%= l(:field_done_ratio) %>: <%= setting_select :commit_update2_done_ratio, (0..10).to_a.collect {|r| ["#{r*10} %", "#{r*10}"] }, :blank => :label_no_change_option, :label => false %>
|
|
| 38 |
<br /><em><%= l(:text_comma_separated) %></em></p> |
|
| 39 |
|
|
| 40 |
<p><%= setting_text_field :commit_update3_keywords, :size => 30 %> |
|
| 41 |
<%= l(:label_applied_status) %>: <%= setting_select :commit_update3_status_id, [["", 0]] + IssueStatus.find(:all).collect{|status| [status.name, status.id.to_s]}, :label => false %>
|
|
| 42 |
<%= l(:field_done_ratio) %>: <%= setting_select :commit_update3_done_ratio, (0..10).to_a.collect {|r| ["#{r*10} %", "#{r*10}"] }, :blank => :label_no_change_option, :label => false %>
|
|
| 43 |
<br /><em><%= l(:text_comma_separated) %></em></p> |
|
| 44 |
|
|
| 45 |
<p><%= setting_text_field :commit_update4_keywords, :size => 30 %> |
|
| 46 |
<%= l(:label_applied_status) %>: <%= setting_select :commit_update4_status_id, [["", 0]] + IssueStatus.find(:all).collect{|status| [status.name, status.id.to_s]}, :label => false %>
|
|
| 47 |
<%= l(:field_done_ratio) %>: <%= setting_select :commit_update4_done_ratio, (0..10).to_a.collect {|r| ["#{r*10} %", "#{r*10}"] }, :blank => :label_no_change_option, :label => false %>
|
|
| 48 |
<br /><em><%= l(:text_comma_separated) %></em></p> |
|
| 49 |
|
|
| 50 |
<p><%= setting_text_field :commit_update5_keywords, :size => 30 %> |
|
| 51 |
<%= l(:label_applied_status) %>: <%= setting_select :commit_update5_status_id, [["", 0]] + IssueStatus.find(:all).collect{|status| [status.name, status.id.to_s]}, :label => false %>
|
|
| 52 |
<%= l(:field_done_ratio) %>: <%= setting_select :commit_update5_done_ratio, (0..10).to_a.collect {|r| ["#{r*10} %", "#{r*10}"] }, :blank => :label_no_change_option, :label => false %>
|
|
| 33 | 53 |
<br /><em><%= l(:text_comma_separated) %></em></p> |
| 34 | 54 |
|
| 35 | 55 |
<p><%= setting_check_box :commit_logtime_enabled, |
| redmine-1.1.0-commit-update/config/locales/en.yml 2011-01-25 17:01:25.799035800 -0700 | ||
|---|---|---|
| 323 | 323 |
setting_autofetch_changesets: Autofetch commits |
| 324 | 324 |
setting_sys_api_enabled: Enable WS for repository management |
| 325 | 325 |
setting_commit_ref_keywords: Referencing keywords |
| 326 |
setting_commit_fix_keywords: Fixing keywords |
|
| 326 |
setting_commit_update1_keywords: Keywords |
|
| 327 |
setting_commit_update2_keywords: Keywords |
|
| 328 |
setting_commit_update3_keywords: Keywords |
|
| 329 |
setting_commit_update4_keywords: Keywords |
|
| 330 |
setting_commit_update5_keywords: Keywords |
|
| 327 | 331 |
setting_autologin: Autologin |
| 328 | 332 |
setting_date_format: Date format |
| 329 | 333 |
setting_time_format: Time format |
| ... | ... | |
| 872 | 876 |
text_unallowed_characters: Unallowed characters |
| 873 | 877 |
text_comma_separated: Multiple values allowed (comma separated). |
| 874 | 878 |
text_line_separated: Multiple values allowed (one line for each value). |
| 875 |
text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages
|
|
| 879 |
text_issues_ref_in_commit_messages: Referencing and updating issues in commit messages
|
|
| 876 | 880 |
text_issue_added: "Issue %{id} has been reported by %{author}."
|
| 877 | 881 |
text_issue_updated: "Issue %{id} has been updated by %{author}."
|
| 878 | 882 |
text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? |
| redmine-1.1.0-commit-update/config/settings.yml 2011-01-25 16:57:19.159989300 -0700 | ||
|---|---|---|
| 92 | 92 |
default: 0 |
| 93 | 93 |
sys_api_key: |
| 94 | 94 |
default: '' |
| 95 |
# commit actions |
|
| 95 | 96 |
commit_ref_keywords: |
| 96 | 97 |
default: 'refs,references,IssueID' |
| 97 |
commit_fix_keywords: |
|
| 98 |
# commit update 1 |
|
| 99 |
commit_update1_keywords: |
|
| 98 | 100 |
default: 'fixes,closes' |
| 99 |
commit_fix_status_id:
|
|
| 101 |
commit_update1_status_id:
|
|
| 100 | 102 |
format: int |
| 101 | 103 |
default: 0 |
| 102 |
commit_fix_done_ratio: |
|
| 104 |
commit_update1_done_ratio: |
|
| 105 |
default: 100 |
|
| 106 |
# commit update 2 |
|
| 107 |
commit_update2_keywords: |
|
| 108 |
default: '' |
|
| 109 |
commit_update2_status_id: |
|
| 110 |
format: int |
|
| 111 |
default: 0 |
|
| 112 |
commit_update2_done_ratio: |
|
| 113 |
default: 100 |
|
| 114 |
# commit update 3 |
|
| 115 |
commit_update3_keywords: |
|
| 116 |
default: '' |
|
| 117 |
commit_update3_status_id: |
|
| 118 |
format: int |
|
| 119 |
default: 0 |
|
| 120 |
commit_update3_done_ratio: |
|
| 121 |
default: 100 |
|
| 122 |
# commitupdate 4 |
|
| 123 |
commit_update4_keywords: |
|
| 124 |
default: '' |
|
| 125 |
commit_update4_status_id: |
|
| 126 |
format: int |
|
| 127 |
default: 0 |
|
| 128 |
commit_update4_done_ratio: |
|
| 129 |
default: 100 |
|
| 130 |
# commit update 5 |
|
| 131 |
commit_update5_keywords: |
|
| 132 |
default: '' |
|
| 133 |
commit_update5_status_id: |
|
| 134 |
format: int |
|
| 135 |
default: 0 |
|
| 136 |
commit_update5_done_ratio: |
|
| 103 | 137 |
default: 100 |
| 104 | 138 |
commit_logtime_enabled: |
| 105 | 139 |
default: 0 |