@@ -89,7 +89,7 class Changeset < ActiveRecord::Base | |||
|
89 | 89 | if ref_keywords.delete('*') |
|
90 | 90 | # find any issue ID in the comments |
|
91 | 91 | target_issue_ids = [] |
|
92 | comments.scan(%r{([\s\(,-]|^)#(\d+)(?=[[:punct:]]|\s|<|$)}).each { |m| target_issue_ids << m[1] } | |
|
92 | comments.scan(%r{([\s\(\[,-]|^)#(\d+)(?=[[:punct:]]|\s|<|$)}).each { |m| target_issue_ids << m[1] } | |
|
93 | 93 | referenced_issues += repository.project.issues.find_all_by_id(target_issue_ids) |
|
94 | 94 | end |
|
95 | 95 |
@@ -53,6 +53,28 class ChangesetTest < Test::Unit::TestCase | |||
|
53 | 53 | assert_equal [1], c.issue_ids.sort |
|
54 | 54 | end |
|
55 | 55 | |
|
56 | def test_ref_keywords_allow_brackets_around_a_issue_number | |
|
57 | Setting.commit_ref_keywords = '*' | |
|
58 | ||
|
59 | c = Changeset.new(:repository => Project.find(1).repository, | |
|
60 | :committed_on => Time.now, | |
|
61 | :comments => '[#1] Worked on this issue') | |
|
62 | c.scan_comment_for_issue_ids | |
|
63 | ||
|
64 | assert_equal [1], c.issue_ids.sort | |
|
65 | end | |
|
66 | ||
|
67 | def test_ref_keywords_allow_brackets_around_multiple_issue_numbers | |
|
68 | Setting.commit_ref_keywords = '*' | |
|
69 | ||
|
70 | c = Changeset.new(:repository => Project.find(1).repository, | |
|
71 | :committed_on => Time.now, | |
|
72 | :comments => '[#1 #2, #3] Worked on these') | |
|
73 | c.scan_comment_for_issue_ids | |
|
74 | ||
|
75 | assert_equal [1,2,3], c.issue_ids.sort | |
|
76 | end | |
|
77 | ||
|
56 | 78 | def test_previous |
|
57 | 79 | changeset = Changeset.find_by_revision('3') |
|
58 | 80 | assert_equal Changeset.find_by_revision('2'), changeset.previous |
General Comments 0
You need to be logged in to leave comments.
Login now