##// END OF EJS Templates
Added the ability to set the "done ratio" of issues fixed by commit (original path by Nikolay Solakov, slightly edited)....
Jean-Philippe Lang -
r810:5f10cc867327
parent child
Show More
@@ -1,84 +1,86
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
2 # Copyright (C) 2006-2007 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.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 class Changeset < ActiveRecord::Base
18 class Changeset < ActiveRecord::Base
19 belongs_to :repository
19 belongs_to :repository
20 has_many :changes, :dependent => :delete_all
20 has_many :changes, :dependent => :delete_all
21 has_and_belongs_to_many :issues
21 has_and_belongs_to_many :issues
22
22
23 acts_as_event :title => Proc.new {|o| "#{l(:label_revision)} #{o.revision}" + (o.comments.blank? ? '' : (': ' + o.comments))},
23 acts_as_event :title => Proc.new {|o| "#{l(:label_revision)} #{o.revision}" + (o.comments.blank? ? '' : (': ' + o.comments))},
24 :description => :comments,
24 :description => :comments,
25 :datetime => :committed_on,
25 :datetime => :committed_on,
26 :author => :committer,
26 :author => :committer,
27 :url => Proc.new {|o| {:controller => 'repositories', :action => 'revision', :id => o.repository.project_id, :rev => o.revision}}
27 :url => Proc.new {|o| {:controller => 'repositories', :action => 'revision', :id => o.repository.project_id, :rev => o.revision}}
28
28
29 acts_as_searchable :columns => 'comments',
29 acts_as_searchable :columns => 'comments',
30 :include => :repository,
30 :include => :repository,
31 :project_key => "#{Repository.table_name}.project_id",
31 :project_key => "#{Repository.table_name}.project_id",
32 :date_column => 'committed_on'
32 :date_column => 'committed_on'
33
33
34 validates_presence_of :repository_id, :revision, :committed_on, :commit_date
34 validates_presence_of :repository_id, :revision, :committed_on, :commit_date
35 validates_numericality_of :revision, :only_integer => true
35 validates_numericality_of :revision, :only_integer => true
36 validates_uniqueness_of :revision, :scope => :repository_id
36 validates_uniqueness_of :revision, :scope => :repository_id
37 validates_uniqueness_of :scmid, :scope => :repository_id, :allow_nil => true
37 validates_uniqueness_of :scmid, :scope => :repository_id, :allow_nil => true
38
38
39 def comments=(comment)
39 def comments=(comment)
40 write_attribute(:comments, comment.strip)
40 write_attribute(:comments, comment.strip)
41 end
41 end
42
42
43 def committed_on=(date)
43 def committed_on=(date)
44 self.commit_date = date
44 self.commit_date = date
45 super
45 super
46 end
46 end
47
47
48 def after_create
48 def after_create
49 scan_comment_for_issue_ids
49 scan_comment_for_issue_ids
50 end
50 end
51
51
52 def scan_comment_for_issue_ids
52 def scan_comment_for_issue_ids
53 return if comments.blank?
53 return if comments.blank?
54 # keywords used to reference issues
54 # keywords used to reference issues
55 ref_keywords = Setting.commit_ref_keywords.downcase.split(",")
55 ref_keywords = Setting.commit_ref_keywords.downcase.split(",")
56 # keywords used to fix issues
56 # keywords used to fix issues
57 fix_keywords = Setting.commit_fix_keywords.downcase.split(",")
57 fix_keywords = Setting.commit_fix_keywords.downcase.split(",")
58 # status applied
58 # status and optional done ratio applied
59 fix_status = IssueStatus.find_by_id(Setting.commit_fix_status_id)
59 fix_status = IssueStatus.find_by_id(Setting.commit_fix_status_id)
60 done_ratio = Setting.commit_fix_done_ratio.blank? ? nil : Setting.commit_fix_done_ratio.to_i
60
61
61 kw_regexp = (ref_keywords + fix_keywords).collect{|kw| Regexp.escape(kw.strip)}.join("|")
62 kw_regexp = (ref_keywords + fix_keywords).collect{|kw| Regexp.escape(kw.strip)}.join("|")
62 return if kw_regexp.blank?
63 return if kw_regexp.blank?
63
64
64 # remove any associated issues
65 # remove any associated issues
65 self.issues.clear
66 self.issues.clear
66
67
67 comments.scan(Regexp.new("(#{kw_regexp})[\s:]+(([\s,;&]*#?\\d+)+)", Regexp::IGNORECASE)).each do |match|
68 comments.scan(Regexp.new("(#{kw_regexp})[\s:]+(([\s,;&]*#?\\d+)+)", Regexp::IGNORECASE)).each do |match|
68 action = match[0]
69 action = match[0]
69 target_issue_ids = match[1].scan(/\d+/)
70 target_issue_ids = match[1].scan(/\d+/)
70 target_issues = repository.project.issues.find_all_by_id(target_issue_ids)
71 target_issues = repository.project.issues.find_all_by_id(target_issue_ids)
71 if fix_status && fix_keywords.include?(action.downcase)
72 if fix_status && fix_keywords.include?(action.downcase)
72 # update status of issues
73 # update status of issues
73 logger.debug "Issues fixed by changeset #{self.revision}: #{issue_ids.join(', ')}." if logger && logger.debug?
74 logger.debug "Issues fixed by changeset #{self.revision}: #{issue_ids.join(', ')}." if logger && logger.debug?
74 target_issues.each do |issue|
75 target_issues.each do |issue|
75 # don't change the status is the issue is already closed
76 # don't change the status is the issue is already closed
76 next if issue.status.is_closed?
77 next if issue.status.is_closed?
77 issue.status = fix_status
78 issue.status = fix_status
79 issue.done_ratio = done_ratio if done_ratio
78 issue.save
80 issue.save
79 end
81 end
80 end
82 end
81 self.issues << target_issues
83 self.issues << target_issues
82 end
84 end
83 end
85 end
84 end
86 end
@@ -1,93 +1,94
1 <h2><%= l(:label_settings) %></h2>
1 <h2><%= l(:label_settings) %></h2>
2
2
3 <div id="settings">
3 <div id="settings">
4 <% form_tag({:action => 'edit'}) do %>
4 <% form_tag({:action => 'edit'}) do %>
5 <div class="box tabular">
5 <div class="box tabular">
6 <p><label><%= l(:setting_app_title) %></label>
6 <p><label><%= l(:setting_app_title) %></label>
7 <%= text_field_tag 'settings[app_title]', Setting.app_title, :size => 30 %></p>
7 <%= text_field_tag 'settings[app_title]', Setting.app_title, :size => 30 %></p>
8
8
9 <p><label><%= l(:setting_app_subtitle) %></label>
9 <p><label><%= l(:setting_app_subtitle) %></label>
10 <%= text_field_tag 'settings[app_subtitle]', Setting.app_subtitle, :size => 60 %></p>
10 <%= text_field_tag 'settings[app_subtitle]', Setting.app_subtitle, :size => 60 %></p>
11
11
12 <p><label><%= l(:setting_welcome_text) %></label>
12 <p><label><%= l(:setting_welcome_text) %></label>
13 <%= text_area_tag 'settings[welcome_text]', Setting.welcome_text, :cols => 60, :rows => 5, :class => 'wiki-edit' %></p>
13 <%= text_area_tag 'settings[welcome_text]', Setting.welcome_text, :cols => 60, :rows => 5, :class => 'wiki-edit' %></p>
14 <%= wikitoolbar_for 'settings[welcome_text]' %>
14 <%= wikitoolbar_for 'settings[welcome_text]' %>
15
15
16 <p><label><%= l(:label_theme) %></label>
16 <p><label><%= l(:label_theme) %></label>
17 <%= select_tag 'settings[ui_theme]', options_for_select( ([[l(:label_default), '']] + Redmine::Themes.themes.collect {|t| [t.name, t.id]}), Setting.ui_theme) %></p>
17 <%= select_tag 'settings[ui_theme]', options_for_select( ([[l(:label_default), '']] + Redmine::Themes.themes.collect {|t| [t.name, t.id]}), Setting.ui_theme) %></p>
18
18
19 <p><label><%= l(:setting_default_language) %></label>
19 <p><label><%= l(:setting_default_language) %></label>
20 <%= select_tag 'settings[default_language]', options_for_select( lang_options_for_select(false), Setting.default_language) %></p>
20 <%= select_tag 'settings[default_language]', options_for_select( lang_options_for_select(false), Setting.default_language) %></p>
21
21
22 <p><label><%= l(:setting_date_format) %></label>
22 <p><label><%= l(:setting_date_format) %></label>
23 <%= select_tag 'settings[date_format]', options_for_select( [[l(:label_language_based), '0'], ['ISO 8601 (YYYY-MM-DD)', '1']], Setting.date_format) %></p>
23 <%= select_tag 'settings[date_format]', options_for_select( [[l(:label_language_based), '0'], ['ISO 8601 (YYYY-MM-DD)', '1']], Setting.date_format) %></p>
24
24
25 <p><label><%= l(:setting_attachment_max_size) %></label>
25 <p><label><%= l(:setting_attachment_max_size) %></label>
26 <%= text_field_tag 'settings[attachment_max_size]', Setting.attachment_max_size, :size => 6 %> KB</p>
26 <%= text_field_tag 'settings[attachment_max_size]', Setting.attachment_max_size, :size => 6 %> KB</p>
27
27
28 <p><label><%= l(:setting_issues_export_limit) %></label>
28 <p><label><%= l(:setting_issues_export_limit) %></label>
29 <%= text_field_tag 'settings[issues_export_limit]', Setting.issues_export_limit, :size => 6 %></p>
29 <%= text_field_tag 'settings[issues_export_limit]', Setting.issues_export_limit, :size => 6 %></p>
30
30
31 <p><label><%= l(:setting_cross_project_issue_relations) %></label>
31 <p><label><%= l(:setting_cross_project_issue_relations) %></label>
32 <%= check_box_tag 'settings[cross_project_issue_relations]', 1, Setting.cross_project_issue_relations? %><%= hidden_field_tag 'settings[cross_project_issue_relations]', 0 %></p>
32 <%= check_box_tag 'settings[cross_project_issue_relations]', 1, Setting.cross_project_issue_relations? %><%= hidden_field_tag 'settings[cross_project_issue_relations]', 0 %></p>
33
33
34 <p><label><%= l(:setting_mail_from) %></label>
34 <p><label><%= l(:setting_mail_from) %></label>
35 <%= text_field_tag 'settings[mail_from]', Setting.mail_from, :size => 60 %></p>
35 <%= text_field_tag 'settings[mail_from]', Setting.mail_from, :size => 60 %></p>
36
36
37 <p><label><%= l(:setting_host_name) %></label>
37 <p><label><%= l(:setting_host_name) %></label>
38 <%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %></p>
38 <%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %></p>
39
39
40 <p><label><%= l(:setting_text_formatting) %></label>
40 <p><label><%= l(:setting_text_formatting) %></label>
41 <%= select_tag 'settings[text_formatting]', options_for_select([[l(:label_none), "0"], ["textile", "textile"]], Setting.text_formatting) %></p>
41 <%= select_tag 'settings[text_formatting]', options_for_select([[l(:label_none), "0"], ["textile", "textile"]], Setting.text_formatting) %></p>
42
42
43 <p><label><%= l(:setting_wiki_compression) %></label>
43 <p><label><%= l(:setting_wiki_compression) %></label>
44 <%= select_tag 'settings[wiki_compression]', options_for_select( [[l(:label_none), 0], ["gzip", "gzip"]], Setting.wiki_compression) %></p>
44 <%= select_tag 'settings[wiki_compression]', options_for_select( [[l(:label_none), 0], ["gzip", "gzip"]], Setting.wiki_compression) %></p>
45
45
46 <p><label><%= l(:setting_feeds_limit) %></label>
46 <p><label><%= l(:setting_feeds_limit) %></label>
47 <%= text_field_tag 'settings[feeds_limit]', Setting.feeds_limit, :size => 6 %></p>
47 <%= text_field_tag 'settings[feeds_limit]', Setting.feeds_limit, :size => 6 %></p>
48
48
49 <p><label><%= l(:setting_autofetch_changesets) %></label>
49 <p><label><%= l(:setting_autofetch_changesets) %></label>
50 <%= check_box_tag 'settings[autofetch_changesets]', 1, Setting.autofetch_changesets? %><%= hidden_field_tag 'settings[autofetch_changesets]', 0 %></p>
50 <%= check_box_tag 'settings[autofetch_changesets]', 1, Setting.autofetch_changesets? %><%= hidden_field_tag 'settings[autofetch_changesets]', 0 %></p>
51
51
52 <p><label><%= l(:setting_sys_api_enabled) %></label>
52 <p><label><%= l(:setting_sys_api_enabled) %></label>
53 <%= check_box_tag 'settings[sys_api_enabled]', 1, Setting.sys_api_enabled? %><%= hidden_field_tag 'settings[sys_api_enabled]', 0 %></p>
53 <%= check_box_tag 'settings[sys_api_enabled]', 1, Setting.sys_api_enabled? %><%= hidden_field_tag 'settings[sys_api_enabled]', 0 %></p>
54
54
55 <p><label><%= l(:setting_repositories_encodings) %></label>
55 <p><label><%= l(:setting_repositories_encodings) %></label>
56 <%= text_field_tag 'settings[repositories_encodings]', Setting.repositories_encodings, :size => 60 %><br /><em><%= l(:text_comma_separated) %></em></p>
56 <%= text_field_tag 'settings[repositories_encodings]', Setting.repositories_encodings, :size => 60 %><br /><em><%= l(:text_comma_separated) %></em></p>
57 </div>
57 </div>
58
58
59 <fieldset class="box"><legend><%= l(:setting_issue_list_default_columns) %></legend>
59 <fieldset class="box"><legend><%= l(:setting_issue_list_default_columns) %></legend>
60 <%= hidden_field_tag 'settings[issue_list_default_columns][]', '' %>
60 <%= hidden_field_tag 'settings[issue_list_default_columns][]', '' %>
61 <p><% Query.available_columns.each do |column| %>
61 <p><% Query.available_columns.each do |column| %>
62 <label><%= check_box_tag 'settings[issue_list_default_columns][]', column.name, Setting.issue_list_default_columns.include?(column.name.to_s) %>
62 <label><%= check_box_tag 'settings[issue_list_default_columns][]', column.name, Setting.issue_list_default_columns.include?(column.name.to_s) %>
63 <%= l("field_#{column.name}") %></label>
63 <%= l("field_#{column.name}") %></label>
64 <% end %></p>
64 <% end %></p>
65 </fieldset>
65 </fieldset>
66
66
67 <fieldset class="box tabular"><legend><%= l(:label_authentication) %></legend>
67 <fieldset class="box tabular"><legend><%= l(:label_authentication) %></legend>
68 <p><label><%= l(:setting_login_required) %></label>
68 <p><label><%= l(:setting_login_required) %></label>
69 <%= check_box_tag 'settings[login_required]', 1, Setting.login_required? %><%= hidden_field_tag 'settings[login_required]', 0 %></p>
69 <%= check_box_tag 'settings[login_required]', 1, Setting.login_required? %><%= hidden_field_tag 'settings[login_required]', 0 %></p>
70
70
71 <p><label><%= l(:setting_autologin) %></label>
71 <p><label><%= l(:setting_autologin) %></label>
72 <%= select_tag 'settings[autologin]', options_for_select( [[l(:label_disabled), "0"]] + [1, 7, 30, 365].collect{|days| [lwr(:actionview_datehelper_time_in_words_day, days), days.to_s]}, Setting.autologin) %></p>
72 <%= select_tag 'settings[autologin]', options_for_select( [[l(:label_disabled), "0"]] + [1, 7, 30, 365].collect{|days| [lwr(:actionview_datehelper_time_in_words_day, days), days.to_s]}, Setting.autologin) %></p>
73
73
74 <p><label><%= l(:setting_self_registration) %></label>
74 <p><label><%= l(:setting_self_registration) %></label>
75 <%= check_box_tag 'settings[self_registration]', 1, Setting.self_registration? %><%= hidden_field_tag 'settings[self_registration]', 0 %></p>
75 <%= check_box_tag 'settings[self_registration]', 1, Setting.self_registration? %><%= hidden_field_tag 'settings[self_registration]', 0 %></p>
76
76
77 <p><label><%= l(:label_password_lost) %></label>
77 <p><label><%= l(:label_password_lost) %></label>
78 <%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %><%= hidden_field_tag 'settings[lost_password]', 0 %></p>
78 <%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %><%= hidden_field_tag 'settings[lost_password]', 0 %></p>
79 </fieldset>
79 </fieldset>
80
80
81 <fieldset class="box tabular"><legend><%= l(:text_issues_ref_in_commit_messages) %></legend>
81 <fieldset class="box tabular"><legend><%= l(:text_issues_ref_in_commit_messages) %></legend>
82 <p><label><%= l(:setting_commit_ref_keywords) %></label>
82 <p><label><%= l(:setting_commit_ref_keywords) %></label>
83 <%= text_field_tag 'settings[commit_ref_keywords]', Setting.commit_ref_keywords, :size => 30 %><br /><em><%= l(:text_comma_separated) %></em></p>
83 <%= text_field_tag 'settings[commit_ref_keywords]', Setting.commit_ref_keywords, :size => 30 %><br /><em><%= l(:text_comma_separated) %></em></p>
84
84
85 <p><label><%= l(:setting_commit_fix_keywords) %></label>
85 <p><label><%= l(:setting_commit_fix_keywords) %></label>
86 <%= text_field_tag 'settings[commit_fix_keywords]', Setting.commit_fix_keywords, :size => 30 %>
86 <%= text_field_tag 'settings[commit_fix_keywords]', Setting.commit_fix_keywords, :size => 30 %>
87 &nbsp;<%= l(:label_applied_status) %>: <%= select_tag 'settings[commit_fix_status_id]', options_for_select( [["", 0]] + IssueStatus.find(:all).collect{|status| [status.name, status.id.to_s]}, Setting.commit_fix_status_id) %>
87 &nbsp;<%= l(:label_applied_status) %>: <%= select_tag 'settings[commit_fix_status_id]', options_for_select( [["", 0]] + IssueStatus.find(:all).collect{|status| [status.name, status.id.to_s]}, Setting.commit_fix_status_id) %>
88 &nbsp;<%= l(:field_done_ratio) %>: <%= select_tag 'settings[commit_fix_done_ratio]', options_for_select( [[l(:label_no_change_option), '']] + ((0..10).to_a.collect {|r| ["#{r*10} %", "#{r*10}"] }), Setting.commit_fix_done_ratio) %>
88 <br /><em><%= l(:text_comma_separated) %></em></p>
89 <br /><em><%= l(:text_comma_separated) %></em></p>
89 </fieldset>
90 </fieldset>
90
91
91 <%= submit_tag l(:button_save) %>
92 <%= submit_tag l(:button_save) %>
92 </div>
93 </div>
93 <% end %> No newline at end of file
94 <% end %>
@@ -1,97 +1,100
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
2 # Copyright (C) 2006-2007 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.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18
18
19 # DO NOT MODIFY THIS FILE !!!
19 # DO NOT MODIFY THIS FILE !!!
20 # Settings can be defined through the application in Admin -> Settings
20 # Settings can be defined through the application in Admin -> Settings
21
21
22 app_title:
22 app_title:
23 default: Redmine
23 default: Redmine
24 app_subtitle:
24 app_subtitle:
25 default: Project management
25 default: Project management
26 welcome_text:
26 welcome_text:
27 default:
27 default:
28 login_required:
28 login_required:
29 default: 0
29 default: 0
30 self_registration:
30 self_registration:
31 default: 1
31 default: 1
32 lost_password:
32 lost_password:
33 default: 1
33 default: 1
34 attachment_max_size:
34 attachment_max_size:
35 format: int
35 format: int
36 default: 5120
36 default: 5120
37 issues_export_limit:
37 issues_export_limit:
38 format: int
38 format: int
39 default: 500
39 default: 500
40 mail_from:
40 mail_from:
41 default: redmine@somenet.foo
41 default: redmine@somenet.foo
42 text_formatting:
42 text_formatting:
43 default: textile
43 default: textile
44 wiki_compression:
44 wiki_compression:
45 default: ""
45 default: ""
46 default_language:
46 default_language:
47 default: en
47 default: en
48 host_name:
48 host_name:
49 default: localhost:3000
49 default: localhost:3000
50 feeds_limit:
50 feeds_limit:
51 format: int
51 format: int
52 default: 15
52 default: 15
53 autofetch_changesets:
53 autofetch_changesets:
54 default: 1
54 default: 1
55 sys_api_enabled:
55 sys_api_enabled:
56 default: 0
56 default: 0
57 commit_ref_keywords:
57 commit_ref_keywords:
58 default: 'refs,references,IssueID'
58 default: 'refs,references,IssueID'
59 commit_fix_keywords:
59 commit_fix_keywords:
60 default: 'fixes,closes'
60 default: 'fixes,closes'
61 commit_fix_status_id:
61 commit_fix_status_id:
62 format: int
62 format: int
63 default: 0
63 default: 0
64 commit_fix_done_ratio:
65 format: int
66 default: 100
64 # autologin duration in days
67 # autologin duration in days
65 # 0 means autologin is disabled
68 # 0 means autologin is disabled
66 autologin:
69 autologin:
67 format: int
70 format: int
68 default: 0
71 default: 0
69 # date format
72 # date format
70 # 0: language based
73 # 0: language based
71 # 1: ISO format
74 # 1: ISO format
72 date_format:
75 date_format:
73 format: int
76 format: int
74 default: 0
77 default: 0
75 cross_project_issue_relations:
78 cross_project_issue_relations:
76 default: 0
79 default: 0
77 notified_events:
80 notified_events:
78 serialized: true
81 serialized: true
79 default: --
82 default: --
80 - issue_added
83 - issue_added
81 - issue_updated
84 - issue_updated
82 issue_list_default_columns:
85 issue_list_default_columns:
83 serialized: true
86 serialized: true
84 default: --
87 default: --
85 - tracker
88 - tracker
86 - status
89 - status
87 - priority
90 - priority
88 - subject
91 - subject
89 - assigned_to
92 - assigned_to
90 - updated_on
93 - updated_on
91 # encodings used to convert repository files content to UTF-8
94 # encodings used to convert repository files content to UTF-8
92 # multiple values accepted, comma separated
95 # multiple values accepted, comma separated
93 repositories_encodings:
96 repositories_encodings:
94 default: ''
97 default: ''
95 ui_theme:
98 ui_theme:
96 default: ''
99 default: ''
97 No newline at end of file
100
@@ -1,71 +1,74
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
2 # Copyright (C) 2006-2007 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.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require File.dirname(__FILE__) + '/../test_helper'
18 require File.dirname(__FILE__) + '/../test_helper'
19
19
20 class RepositoryTest < Test::Unit::TestCase
20 class RepositoryTest < Test::Unit::TestCase
21 fixtures :projects, :repositories, :issues, :issue_statuses, :changesets, :changes
21 fixtures :projects, :repositories, :issues, :issue_statuses, :changesets, :changes
22
22
23 def setup
23 def setup
24 @repository = Project.find(1).repository
24 @repository = Project.find(1).repository
25 end
25 end
26
26
27 def test_create
27 def test_create
28 repository = Repository::Subversion.new(:project => Project.find(2))
28 repository = Repository::Subversion.new(:project => Project.find(2))
29 assert !repository.save
29 assert !repository.save
30
30
31 repository.url = "svn://localhost"
31 repository.url = "svn://localhost"
32 assert repository.save
32 assert repository.save
33 repository.reload
33 repository.reload
34
34
35 project = Project.find(2)
35 project = Project.find(2)
36 assert_equal repository, project.repository
36 assert_equal repository, project.repository
37 end
37 end
38
38
39 def test_scan_changesets_for_issue_ids
39 def test_scan_changesets_for_issue_ids
40 # choosing a status to apply to fix issues
40 # choosing a status to apply to fix issues
41 Setting.commit_fix_status_id = IssueStatus.find(:first, :conditions => ["is_closed = ?", true]).id
41 Setting.commit_fix_status_id = IssueStatus.find(:first, :conditions => ["is_closed = ?", true]).id
42
42 Setting.commit_fix_done_ratio = "90"
43
43 # make sure issue 1 is not already closed
44 # make sure issue 1 is not already closed
44 assert !Issue.find(1).status.is_closed?
45 assert !Issue.find(1).status.is_closed?
45
46
46 Repository.scan_changesets_for_issue_ids
47 Repository.scan_changesets_for_issue_ids
47 assert_equal [101, 102], Issue.find(3).changeset_ids
48 assert_equal [101, 102], Issue.find(3).changeset_ids
48
49
49 # fixed issues
50 # fixed issues
50 assert Issue.find(1).status.is_closed?
51 fixed_issue = Issue.find(1)
51 assert_equal [101], Issue.find(1).changeset_ids
52 assert fixed_issue.status.is_closed?
53 assert_equal 90, fixed_issue.done_ratio
54 assert_equal [101], fixed_issue.changeset_ids
52
55
53 # ignoring commits referencing an issue of another project
56 # ignoring commits referencing an issue of another project
54 assert_equal [], Issue.find(4).changesets
57 assert_equal [], Issue.find(4).changesets
55 end
58 end
56
59
57 def test_for_changeset_comments_strip
60 def test_for_changeset_comments_strip
58 repository = Repository::Mercurial.create( :project => Project.find( 4 ), :url => '/foo/bar/baz' )
61 repository = Repository::Mercurial.create( :project => Project.find( 4 ), :url => '/foo/bar/baz' )
59 comment = <<-COMMENT
62 comment = <<-COMMENT
60 This is a loooooooooooooooooooooooooooong comment
63 This is a loooooooooooooooooooooooooooong comment
61
64
62
65
63 COMMENT
66 COMMENT
64 changeset = Changeset.new(
67 changeset = Changeset.new(
65 :comments => comment, :commit_date => Time.now, :revision => 0, :scmid => 'f39b7922fb3c',
68 :comments => comment, :commit_date => Time.now, :revision => 0, :scmid => 'f39b7922fb3c',
66 :committer => 'foo <foo@example.com>', :committed_on => Time.now, :repository_id => repository )
69 :committer => 'foo <foo@example.com>', :committed_on => Time.now, :repository_id => repository )
67 assert( changeset.save )
70 assert( changeset.save )
68 assert_not_equal( comment, changeset.comments )
71 assert_not_equal( comment, changeset.comments )
69 assert_equal( 'This is a loooooooooooooooooooooooooooong comment', changeset.comments )
72 assert_equal( 'This is a loooooooooooooooooooooooooooong comment', changeset.comments )
70 end
73 end
71 end
74 end
General Comments 0
You need to be logged in to leave comments. Login now