]> git.pld-linux.org Git - packages/cvsspam.git/blame - cvsspam-tracfunc.patch
drop ruby_mod_ver_requires_eq
[packages/cvsspam.git] / cvsspam-tracfunc.patch
CommitLineData
011d6702
ER
1--- cvsspam-0.2.12/cvsspam.rb 2009-04-23 19:19:04.000000000 +0300
2+++ cvsspam-0.2.12/cvsspam.rb 2010-04-07 18:22:52.000000000 +0300
ea6a7490
ER
3@@ -560,6 +560,10 @@
4 jiraSub = proc { |match|
5 "<a href=\"#{$jiraURL.sub(/%s/, match)}\">#{match}</a>"
6 }
7+tracSub = proc { |match|
8+ match =~ /([0-9]+)/
9+ "<a href=\"#{"$tracURL/ticket/%s".sub(/%s/, $1)}\">#{match}</a>"
10+}
11 ticketSub = proc { |match|
12 match =~ /([0-9]+)/
13 "<a href=\"#{$ticketURL.sub(/%s/, $1)}\">#{match}</a>"
14@@ -930,15 +934,15 @@
15 # Link to Trac
16 class TracFrontend < WebFrontend
17 def path_url(path, tag)
18- add_repo("#{@base_url}browser/#{urlEncode(path)}")
19+ add_repo("#{@base_url}/browser/#{urlEncode(path)}")
20 end
21
22 def version_url(path, version)
23- add_repo("#{@base_url}browser/#{urlEncode(path)}?rev=#{version}")
24+ add_repo("#{@base_url}/browser/#{urlEncode(path)}?rev=#{version}")
25 end
26
27 def diff_url(file)
28- add_repo("#{@base_url}changeset/#{file.toVer}")
29+ add_repo("#{@base_url}/changeset/#{file.toVer}")
30 end
31
32 protected
33@@ -949,7 +953,7 @@
34 else
35 log_anchor = ""
36 end
37- add_repo("#{@base_url}log/#{urlEncode(file.path)}#{log_anchor}")
38+ add_repo("#{@base_url}/log/#{urlEncode(file.path)}#{log_anchor}")
39 end
40 end
41
011d6702
ER
42@@ -1699,6 +1703,7 @@
43 $choraURL = nil
44 $cvswebURL = nil
45 $tracURL = nil
46+$tracProjects = nil
47 $from_address = nil
48 $subjectPrefix = nil
49 $files_in_subject = false;
50@@ -1780,6 +1785,24 @@
ea6a7490
ER
51 fail "No email recipients defined"
52 end
53
54+if $viewcvsURL != nil || $cvswebURL !=nil
55+ if $repository_name == GUESS
56+ # use the last component of the repository path as the name
57+ ENV['CVSROOT'] =~ /([^\/]+$)/
58+ $repository_name = $1
59+ end
60+end
61+
62+# if $tracProjects is set, process repository_name to setup new $tracURL
63+if $tracProjects != nil && $tracURL != nil
64+ $tracProjects.sort {|a,b| b[1] <=> a[1] }.each do |project, path|
65+ if $repository_name.index(path) == 0
66+ $tracURL = "#{$tracURL}/#{project}"
67+ break
68+ end
69+ end
70+end
71+
72 if $viewcvsURL != nil
73 $viewcvsURL << "/" unless $viewcvsURL =~ /\/$/
74 $frontend = ViewCVSFrontend.new($viewcvsURL)
011d6702 75@@ -1789,23 +1812,15 @@
ea6a7490
ER
76 $cvswebURL << "/" unless $cvswebURL =~ /\/$/
77 $frontend = CVSwebFrontend.new($cvswebURL)
78 elsif $tracURL !=nil
79- $tracURL << "/" unless $tracURL =~ /\/$/
80 $frontend = TracFrontend.new($tracURL)
81 else
82 $frontend = NoFrontend.new
83 end
84
85-if $viewcvsURL != nil || $cvswebURL !=nil
86- if $repository_name == GUESS
87- # use the last component of the repository path as the name
88- ENV['CVSROOT'] =~ /([^\/]+$)/
89- $frontend.repository_name = $1
90- elsif $repository_name != nil
91- $frontend.repository_name = $repository_name
92- end
93+if $repository_name != nil
94+ $frontend.repository_name = $repository_name
95 end
96
97-
98 if $bugzillaURL != nil
99 commentSubstitutions['\b[Bb](?:[Uu][Gg])?\s*[#:]?\s*\[?[0-9]+\]?'] = bugzillaSub
100 end
011d6702 101@@ -1818,7 +1833,9 @@
ea6a7490
ER
102 if $jiraURL != nil
103 commentSubstitutions['\b[a-zA-Z]+-[0-9]+\b'] = jiraSub
104 end
105-if $ticketURL != nil
106+if $tracURL != nil
107+ commentSubstitutions['\b[Tt][Ii][Cc][Kk][Ee][Tt]\s*#?[0-9]+\b'] = tracSub
108+elsif $ticketURL != nil
109 commentSubstitutions['\b[Tt][Ii][Cc][Kk][Ee][Tt]\s*#?[0-9]+\b'] = ticketSub
110 end
111 if $issueURL != nil
This page took 0.072953 seconds and 4 git commands to generate.