* Referencing issues in commit messages: enter * in 'Referencing keywords' to link any issue id without using keywords.

* Updated Polish translation (Mariusz Olejnik).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@918 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-11-20 12:07:28 +00:00
parent deb182337d
commit 99f9aea80a
5 changed files with 60 additions and 9 deletions

View File

@ -231,7 +231,7 @@ module ApplicationHelper
# example:
# #52 -> <a href="/issues/show/52">#52</a>
# r52 -> <a href="/repositories/revision/6?rev=52">r52</a> (project.id is 6)
text = text.gsub(%r{([\s,-^])(#|r)(\d+)(?=[[:punct:]]|\s|<|$)}) do |m|
text = text.gsub(%r{([\s\(,-^])(#|r)(\d+)(?=[[:punct:]]|\s|<|$)}) do |m|
leading, otype, oid = $1, $2, $3
link = nil
if otype == 'r'

View File

@ -63,6 +63,14 @@ class Changeset < ActiveRecord::Base
return if kw_regexp.blank?
referenced_issues = []
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] }
referenced_issues += repository.project.issues.find_all_by_id(target_issue_ids)
end
comments.scan(Regexp.new("(#{kw_regexp})[\s:]+(([\s,;&]*#?\\d+)+)", Regexp::IGNORECASE)).each do |match|
action = match[0]
target_issue_ids = match[1].scan(/\d+/)
@ -80,6 +88,7 @@ class Changeset < ActiveRecord::Base
end
referenced_issues += target_issues
end
self.issues = referenced_issues.uniq
end
end

View File

@ -261,11 +261,11 @@ label_attachment_delete: Skasuj plik
label_attachment_plural: Pliki
label_report: Raport
label_report_plural: Raporty
label_news: Nowość
label_news_new: Dodaj nowość
label_news_plural: Nowości
label_news_latest: Ostatnie nowości
label_news_view_all: Pokaż wszystkie nowości
label_news: Wiadomość
label_news_new: Dodaj wiadomość
label_news_plural: Wiadomości
label_news_latest: Ostatnie wiadomości
label_news_view_all: Pokaż wszystkie wiadomości
label_change_log: Lista zmian
label_settings: Ustawienia
label_overview: Przegląd
@ -334,7 +334,7 @@ label_latest_revision: Ostatnia zmiana
label_latest_revision_plural: Ostatnie zmiany
label_view_revisions: Pokaż zmiany
label_max_size: Maksymalny rozmiar
label_on: 'włączone'
label_on: 'z'
label_sort_highest: Przesuń na górę
label_sort_higher: Do góry
label_sort_lower: Do dołu
@ -544,4 +544,4 @@ mail_body_account_activation_request: 'Zarejestrowano nowego użytkownika: (%s).
label_registration_automatic_activation: automatyczna aktywacja kont
label_registration_manual_activation: manualna aktywacja kont
notice_account_pending: "Twoje konto zostało utworzone i oczekuje na zatwierdzenie administratora."
field_time_zone: Time zone
field_time_zone: Strefa czasowa

View File

@ -0,0 +1,42 @@
# redMine - project management software
# Copyright (C) 2006-2007 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require File.dirname(__FILE__) + '/../test_helper'
class ChangesetTest < Test::Unit::TestCase
fixtures :projects, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :users, :members, :trackers
def setup
end
def test_ref_keywords_any
Setting.commit_fix_status_id = IssueStatus.find(:first, :conditions => ["is_closed = ?", true]).id
Setting.commit_fix_done_ratio = '90'
Setting.commit_ref_keywords = '*'
Setting.commit_fix_keywords = 'fixes , closes'
c = Changeset.new(:repository => Project.find(1).repository,
:committed_on => Time.now,
:comments => 'New commit (#2). Fixes #1')
c.scan_comment_for_issue_ids
assert_equal [1, 2], c.issue_ids.sort
fixed = Issue.find(1)
assert fixed.closed?
assert_equal 90, fixed.done_ratio
end
end

View File

@ -68,7 +68,7 @@ class RepositoryTest < Test::Unit::TestCase
COMMENT
changeset = Changeset.new(
:comments => comment, :commit_date => Time.now, :revision => 0, :scmid => 'f39b7922fb3c',
:committer => 'foo <foo@example.com>', :committed_on => Time.now, :repository_id => repository )
:committer => 'foo <foo@example.com>', :committed_on => Time.now, :repository => repository )
assert( changeset.save )
assert_not_equal( comment, changeset.comments )
assert_equal( 'This is a loooooooooooooooooooooooooooong comment', changeset.comments )