@@ -0,0 +1,42 | |||
|
1 | # redMine - project management software | |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
|
3 | # | |
|
4 | # This program is free software; you can redistribute it and/or | |
|
5 | # modify it under the terms of the GNU General Public License | |
|
6 | # as published by the Free Software Foundation; either version 2 | |
|
7 | # of the License, or (at your option) any later version. | |
|
8 | # | |
|
9 | # This program is distributed in the hope that it will be useful, | |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
12 | # GNU General Public License for more details. | |
|
13 | # | |
|
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 | |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
|
17 | ||
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
|
19 | ||
|
20 | class ChangesetTest < Test::Unit::TestCase | |
|
21 | fixtures :projects, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :users, :members, :trackers | |
|
22 | ||
|
23 | def setup | |
|
24 | end | |
|
25 | ||
|
26 | def test_ref_keywords_any | |
|
27 | Setting.commit_fix_status_id = IssueStatus.find(:first, :conditions => ["is_closed = ?", true]).id | |
|
28 | Setting.commit_fix_done_ratio = '90' | |
|
29 | Setting.commit_ref_keywords = '*' | |
|
30 | Setting.commit_fix_keywords = 'fixes , closes' | |
|
31 | ||
|
32 | c = Changeset.new(:repository => Project.find(1).repository, | |
|
33 | :committed_on => Time.now, | |
|
34 | :comments => 'New commit (#2). Fixes #1') | |
|
35 | c.scan_comment_for_issue_ids | |
|
36 | ||
|
37 | assert_equal [1, 2], c.issue_ids.sort | |
|
38 | fixed = Issue.find(1) | |
|
39 | assert fixed.closed? | |
|
40 | assert_equal 90, fixed.done_ratio | |
|
41 | end | |
|
42 | end |
@@ -231,7 +231,7 module ApplicationHelper | |||
|
231 | 231 | # example: |
|
232 | 232 | # #52 -> <a href="/issues/show/52">#52</a> |
|
233 | 233 | # r52 -> <a href="/repositories/revision/6?rev=52">r52</a> (project.id is 6) |
|
234 | text = text.gsub(%r{([\s,-^])(#|r)(\d+)(?=[[:punct:]]|\s|<|$)}) do |m| | |
|
234 | text = text.gsub(%r{([\s\(,-^])(#|r)(\d+)(?=[[:punct:]]|\s|<|$)}) do |m| | |
|
235 | 235 | leading, otype, oid = $1, $2, $3 |
|
236 | 236 | link = nil |
|
237 | 237 | if otype == 'r' |
@@ -63,6 +63,14 class Changeset < ActiveRecord::Base | |||
|
63 | 63 | return if kw_regexp.blank? |
|
64 | 64 | |
|
65 | 65 | referenced_issues = [] |
|
66 | ||
|
67 | if ref_keywords.delete('*') | |
|
68 | # find any issue ID in the comments | |
|
69 | target_issue_ids = [] | |
|
70 | comments.scan(%r{([\s\(,-^])#(\d+)(?=[[:punct:]]|\s|<|$)}).each { |m| target_issue_ids << m[1] } | |
|
71 | referenced_issues += repository.project.issues.find_all_by_id(target_issue_ids) | |
|
72 | end | |
|
73 | ||
|
66 | 74 | comments.scan(Regexp.new("(#{kw_regexp})[\s:]+(([\s,;&]*#?\\d+)+)", Regexp::IGNORECASE)).each do |match| |
|
67 | 75 | action = match[0] |
|
68 | 76 | target_issue_ids = match[1].scan(/\d+/) |
@@ -80,6 +88,7 class Changeset < ActiveRecord::Base | |||
|
80 | 88 | end |
|
81 | 89 | referenced_issues += target_issues |
|
82 | 90 | end |
|
91 | ||
|
83 | 92 | self.issues = referenced_issues.uniq |
|
84 | 93 | end |
|
85 | 94 | end |
@@ -261,11 +261,11 label_attachment_delete: Skasuj plik | |||
|
261 | 261 | label_attachment_plural: Pliki |
|
262 | 262 | label_report: Raport |
|
263 | 263 | label_report_plural: Raporty |
|
264 |
label_news: |
|
|
265 |
label_news_new: Dodaj |
|
|
266 |
label_news_plural: |
|
|
267 |
label_news_latest: Ostatnie |
|
|
268 |
label_news_view_all: Pokaż wszystkie |
|
|
264 | label_news: Wiadomość | |
|
265 | label_news_new: Dodaj wiadomość | |
|
266 | label_news_plural: Wiadomości | |
|
267 | label_news_latest: Ostatnie wiadomości | |
|
268 | label_news_view_all: Pokaż wszystkie wiadomości | |
|
269 | 269 | label_change_log: Lista zmian |
|
270 | 270 | label_settings: Ustawienia |
|
271 | 271 | label_overview: Przegląd |
@@ -334,7 +334,7 label_latest_revision: Ostatnia zmiana | |||
|
334 | 334 | label_latest_revision_plural: Ostatnie zmiany |
|
335 | 335 | label_view_revisions: Pokaż zmiany |
|
336 | 336 | label_max_size: Maksymalny rozmiar |
|
337 |
label_on: ' |
|
|
337 | label_on: 'z' | |
|
338 | 338 | label_sort_highest: Przesuń na górę |
|
339 | 339 | label_sort_higher: Do góry |
|
340 | 340 | label_sort_lower: Do dołu |
@@ -544,4 +544,4 mail_body_account_activation_request: 'Zarejestrowano nowego użytkownika: (%s). | |||
|
544 | 544 | label_registration_automatic_activation: automatyczna aktywacja kont |
|
545 | 545 | label_registration_manual_activation: manualna aktywacja kont |
|
546 | 546 | notice_account_pending: "Twoje konto zostało utworzone i oczekuje na zatwierdzenie administratora." |
|
547 |
field_time_zone: |
|
|
547 | field_time_zone: Strefa czasowa |
@@ -68,7 +68,7 class RepositoryTest < Test::Unit::TestCase | |||
|
68 | 68 | COMMENT |
|
69 | 69 | changeset = Changeset.new( |
|
70 | 70 | :comments => comment, :commit_date => Time.now, :revision => 0, :scmid => 'f39b7922fb3c', |
|
71 |
:committer => 'foo <foo@example.com>', :committed_on => Time.now, :repository |
|
|
71 | :committer => 'foo <foo@example.com>', :committed_on => Time.now, :repository => repository ) | |
|
72 | 72 | assert( changeset.save ) |
|
73 | 73 | assert_not_equal( comment, changeset.comments ) |
|
74 | 74 | assert_equal( 'This is a loooooooooooooooooooooooooooong comment', changeset.comments ) |
General Comments 0
You need to be logged in to leave comments.
Login now