Patch #7445 » commit-update-1.4-stable.patch
app/models/changeset.rb | ||
---|---|---|
119 | 119 |
ref_keywords = Setting.commit_ref_keywords.downcase.split(",").collect(&:strip) |
120 | 120 |
ref_keywords_any = ref_keywords.delete('*') |
121 | 121 |
# keywords used to fix issues |
122 |
fix_keywords = Setting.commit_fix_keywords.downcase.split(",").collect(&:strip) |
|
123 | ||
124 |
kw_regexp = (ref_keywords + fix_keywords).collect{|kw| Regexp.escape(kw)}.join("|") |
|
125 | ||
122 |
#fix_keywords = Setting.commit_fix_keywords.downcase.split(",").collect(&:strip) |
|
123 |
|
|
124 |
ref_updates = |
|
125 |
[ { :keywords => Setting.commit_update1_keywords.downcase.split(",").collect(&:strip), |
|
126 |
:status_id => Setting.commit_update1_status_id, |
|
127 |
:done_ratio => Setting.commit_update1_done_ratio }, |
|
128 |
{ :keywords => Setting.commit_update2_keywords.downcase.split(",").collect(&:strip), |
|
129 |
:status_id => Setting.commit_update2_status_id, |
|
130 |
:done_ratio => Setting.commit_update2_done_ratio }, |
|
131 |
{ :keywords => Setting.commit_update3_keywords.downcase.split(",").collect(&:strip), |
|
132 |
:status_id => Setting.commit_update3_status_id, |
|
133 |
:done_ratio => Setting.commit_update3_done_ratio }, |
|
134 |
{ :keywords => Setting.commit_update4_keywords.downcase.split(",").collect(&:strip), |
|
135 |
:status_id => Setting.commit_update4_status_id, |
|
136 |
:done_ratio => Setting.commit_update4_done_ratio }, |
|
137 |
{ :keywords => Setting.commit_update5_keywords.downcase.split(",").collect(&:strip), |
|
138 |
:status_id => Setting.commit_update5_status_id, |
|
139 |
:done_ratio => Setting.commit_update5_done_ratio } ] |
|
140 | ||
141 |
#kw_regexp = (ref_keywords + fix_keywords).collect{|kw| Regexp.escape(kw)}.join("|") |
|
142 |
kw_regexp = (ref_keywords + ref_updates.collect{|u| u[:keywords]}.flatten).collect{|kw| Regexp.escape(kw)}.join("|") |
|
143 |
|
|
126 | 144 |
referenced_issues = [] |
127 | 145 | |
128 | 146 |
comments.scan(/([\s\(\[,-]|^)((#{kw_regexp})[\s:]+)?(#\d+(\s+@#{TIMELOG_RE})?([\s,;&]+#\d+(\s+@#{TIMELOG_RE})?)*)(?=[[:punct:]]|\s|<|$)/i) do |match| |
... | ... | |
132 | 150 |
refs.scan(/#(\d+)(\s+@#{TIMELOG_RE})?/).each do |m| |
133 | 151 |
issue, hours = find_referenced_issue_by_id(m[0].to_i), m[2] |
134 | 152 |
if issue |
153 |
#referenced_issues << issue |
|
154 |
#fix_issue(issue) if fix_keywords.include?(action.to_s.downcase) |
|
155 |
|
|
135 | 156 |
referenced_issues << issue |
136 |
fix_issue(issue) if fix_keywords.include?(action.to_s.downcase) |
|
157 |
ref_updates.each do |u| |
|
158 |
update_issue(issue, u[:status_id], u[:done_ratio]) if u[:keywords].include?(action.to_s.downcase) |
|
159 |
end |
|
160 |
|
|
137 | 161 |
log_time(issue, hours) if hours && Setting.commit_logtime_enabled? |
138 | 162 |
end |
139 | 163 |
end |
... | ... | |
217 | 241 | |
218 | 242 |
private |
219 | 243 | |
220 |
def fix_issue(issue) |
|
221 |
status = IssueStatus.find_by_id(Setting.commit_fix_status_id.to_i) |
|
244 |
#def fix_issue(issue) |
|
245 |
# status = IssueStatus.find_by_id(Setting.commit_fix_status_id.to_i) |
|
246 |
def update_issue(issue, status_id, done_ratio) |
|
247 |
status = IssueStatus.find_by_id(status_id.to_i) |
|
222 | 248 |
if status.nil? |
223 |
logger.warn("No status matches commit_fix_status_id setting (#{Setting.commit_fix_status_id})") if logger |
|
249 |
#logger.warn("No status matches commit_fix_status_id setting (#{Setting.commit_fix_status_id})") if logger |
|
250 |
logger.warn("No status matches commit_update_status_id setting (#{status_id})") if logger |
|
224 | 251 |
return issue |
225 | 252 |
end |
226 | 253 | |
... | ... | |
231 | 258 | |
232 | 259 |
journal = issue.init_journal(user || User.anonymous, ll(Setting.default_language, :text_status_changed_by_changeset, text_tag(issue.project))) |
233 | 260 |
issue.status = status |
234 |
unless Setting.commit_fix_done_ratio.blank? |
|
235 |
issue.done_ratio = Setting.commit_fix_done_ratio.to_i |
|
261 |
#unless Setting.commit_fix_done_ratio.blank? |
|
262 |
#issue.done_ratio = Setting.commit_fix_done_ratio.to_i |
|
263 |
unless done_ratio.blank? |
|
264 |
issue.done_ratio = done_ratio.to_i |
|
236 | 265 |
end |
237 | 266 |
Redmine::Hook.call_hook(:model_changeset_scan_commit_for_issue_ids_pre_issue_update, |
238 | 267 |
{ :changeset => self, :issue => issue }) |
app/views/settings/_repositories.html.erb | ||
---|---|---|
68 | 68 |
<p><%= setting_text_field :commit_ref_keywords, :size => 30 %> |
69 | 69 |
<em class="info"><%= l(:text_comma_separated) %></em></p> |
70 | 70 | |
71 |
<p><%= setting_text_field :commit_fix_keywords, :size => 30 %> |
|
72 |
<%= l(:label_applied_status) %>: <%= setting_select :commit_fix_status_id, |
|
73 |
[["", 0]] + |
|
74 |
IssueStatus.find(:all).collect{ |
|
75 |
|status| [status.name, status.id.to_s] |
|
76 |
}, |
|
77 |
:label => false %> |
|
78 |
<%= l(:field_done_ratio) %>: <%= setting_select :commit_fix_done_ratio, |
|
79 |
(0..10).to_a.collect {|r| ["#{r*10} %", "#{r*10}"] }, |
|
80 |
:blank => :label_no_change_option, |
|
81 |
:label => false %> |
|
71 |
<p><%= setting_text_field :commit_update1_keywords, :size => 30 %> |
|
72 |
<%= l(:label_applied_status) %>: <%= setting_select :commit_update1_status_id, [["", 0]] + IssueStatus.find(:all).collect{|status| [status.name, status.id.to_s]}, :label => false %> |
|
73 |
<%= 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 %> |
|
74 |
<br /><em><%= l(:text_comma_separated) %></em></p> |
|
75 | ||
76 |
<p><%= setting_text_field :commit_update2_keywords, :size => 30 %> |
|
77 |
<%= l(:label_applied_status) %>: <%= setting_select :commit_update2_status_id, [["", 0]] + IssueStatus.find(:all).collect{|status| [status.name, status.id.to_s]}, :label => false %> |
|
78 |
<%= 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 %> |
|
79 |
<br /><em><%= l(:text_comma_separated) %></em></p> |
|
80 | ||
81 |
<p><%= setting_text_field :commit_update3_keywords, :size => 30 %> |
|
82 |
<%= l(:label_applied_status) %>: <%= setting_select :commit_update3_status_id, [["", 0]] + IssueStatus.find(:all).collect{|status| [status.name, status.id.to_s]}, :label => false %> |
|
83 |
<%= 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 %> |
|
84 |
<br /><em><%= l(:text_comma_separated) %></em></p> |
|
85 | ||
86 |
<p><%= setting_text_field :commit_update4_keywords, :size => 30 %> |
|
87 |
<%= l(:label_applied_status) %>: <%= setting_select :commit_update4_status_id, [["", 0]] + IssueStatus.find(:all).collect{|status| [status.name, status.id.to_s]}, :label => false %> |
|
88 |
<%= 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 %> |
|
89 |
<br /><em><%= l(:text_comma_separated) %></em></p> |
|
90 | ||
91 |
<p><%= setting_text_field :commit_update5_keywords, :size => 30 %> |
|
92 |
<%= l(:label_applied_status) %>: <%= setting_select :commit_update5_status_id, [["", 0]] + IssueStatus.find(:all).collect{|status| [status.name, status.id.to_s]}, :label => false %> |
|
93 |
<%= 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 %> |
|
94 | ||
82 | 95 |
<em class="info"><%= l(:text_comma_separated) %></em></p> |
83 | 96 | |
84 | 97 |
<p><%= setting_check_box :commit_cross_project_ref %></p> |
config/locales/en.yml | ||
---|---|---|
343 | 343 |
setting_autofetch_changesets: Fetch commits automatically |
344 | 344 |
setting_sys_api_enabled: Enable WS for repository management |
345 | 345 |
setting_commit_ref_keywords: Referencing keywords |
346 |
setting_commit_fix_keywords: Fixing keywords |
|
346 |
setting_commit_update1_keywords: Keywords |
|
347 |
setting_commit_update2_keywords: Keywords |
|
348 |
setting_commit_update3_keywords: Keywords |
|
349 |
setting_commit_update4_keywords: Keywords |
|
350 |
setting_commit_update5_keywords: Keywords |
|
347 | 351 |
setting_autologin: Autologin |
348 | 352 |
setting_date_format: Date format |
349 | 353 |
setting_time_format: Time format |
... | ... | |
932 | 936 |
text_unallowed_characters: Unallowed characters |
933 | 937 |
text_comma_separated: Multiple values allowed (comma separated). |
934 | 938 |
text_line_separated: Multiple values allowed (one line for each value). |
935 |
text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages
|
|
939 |
text_issues_ref_in_commit_messages: Referencing and updating issues in commit messages
|
|
936 | 940 |
text_issue_added: "Issue %{id} has been reported by %{author}." |
937 | 941 |
text_issue_updated: "Issue %{id} has been updated by %{author}." |
938 | 942 |
text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content? |
config/settings.yml | ||
---|---|---|
94 | 94 |
default: 0 |
95 | 95 |
sys_api_key: |
96 | 96 |
default: '' |
97 |
# commit actions |
|
97 | 98 |
commit_cross_project_ref: |
98 | 99 |
default: 0 |
99 | 100 |
commit_ref_keywords: |
100 | 101 |
default: 'refs,references,IssueID' |
101 |
commit_fix_keywords: |
|
102 |
# commit update 1 |
|
103 |
commit_update1_keywords: |
|
102 | 104 |
default: 'fixes,closes' |
103 |
commit_fix_status_id:
|
|
105 |
commit_update1_status_id:
|
|
104 | 106 |
format: int |
105 | 107 |
default: 0 |
106 |
commit_fix_done_ratio: |
|
108 |
commit_update1_done_ratio: |
|
109 |
default: 100 |
|
110 |
# commit update 2 |
|
111 |
commit_update2_keywords: |
|
112 |
default: '' |
|
113 |
commit_update2_status_id: |
|
114 |
format: int |
|
115 |
default: 0 |
|
116 |
commit_update2_done_ratio: |
|
117 |
default: 100 |
|
118 |
# commit update 3 |
|
119 |
commit_update3_keywords: |
|
120 |
default: '' |
|
121 |
commit_update3_status_id: |
|
122 |
format: int |
|
123 |
default: 0 |
|
124 |
commit_update3_done_ratio: |
|
125 |
default: 100 |
|
126 |
# commitupdate 4 |
|
127 |
commit_update4_keywords: |
|
128 |
default: '' |
|
129 |
commit_update4_status_id: |
|
130 |
format: int |
|
131 |
default: 0 |
|
132 |
commit_update4_done_ratio: |
|
133 |
default: 100 |
|
134 |
# commit update 5 |
|
135 |
commit_update5_keywords: |
|
136 |
default: '' |
|
137 |
commit_update5_status_id: |
|
138 |
format: int |
|
139 |
default: 0 |
|
140 |
commit_update5_done_ratio: |
|
107 | 141 |
default: 100 |
108 | 142 |
commit_logtime_enabled: |
109 | 143 |
default: 0 |
- « Previous
- 1
- 2
- 3
- 4
- Next »