]> git.pld-linux.org Git - packages/cvsspam.git/blame - cvsspam-tracfunc.patch
- old patch recovered (2009-04-23)
[packages/cvsspam.git] / cvsspam-tracfunc.patch
CommitLineData
ea6a7490
ER
1--- cvsspam-0.2.12/cvsspam.rb~ 2009-04-23 20:18:09.329309382 +0300
2+++ cvsspam-0.2.12/cvsspam.rb 2009-04-23 19:19:04.000000000 +0300
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
42@@ -1772,6 +1784,24 @@
43 fail "No email recipients defined"
44 end
45
46+if $viewcvsURL != nil || $cvswebURL !=nil
47+ if $repository_name == GUESS
48+ # use the last component of the repository path as the name
49+ ENV['CVSROOT'] =~ /([^\/]+$)/
50+ $repository_name = $1
51+ end
52+end
53+
54+# if $tracProjects is set, process repository_name to setup new $tracURL
55+if $tracProjects != nil && $tracURL != nil
56+ $tracProjects.sort {|a,b| b[1] <=> a[1] }.each do |project, path|
57+ if $repository_name.index(path) == 0
58+ $tracURL = "#{$tracURL}/#{project}"
59+ break
60+ end
61+ end
62+end
63+
64 if $viewcvsURL != nil
65 $viewcvsURL << "/" unless $viewcvsURL =~ /\/$/
66 $frontend = ViewCVSFrontend.new($viewcvsURL)
67@@ -1781,23 +1811,15 @@
68 $cvswebURL << "/" unless $cvswebURL =~ /\/$/
69 $frontend = CVSwebFrontend.new($cvswebURL)
70 elsif $tracURL !=nil
71- $tracURL << "/" unless $tracURL =~ /\/$/
72 $frontend = TracFrontend.new($tracURL)
73 else
74 $frontend = NoFrontend.new
75 end
76
77-if $viewcvsURL != nil || $cvswebURL !=nil
78- if $repository_name == GUESS
79- # use the last component of the repository path as the name
80- ENV['CVSROOT'] =~ /([^\/]+$)/
81- $frontend.repository_name = $1
82- elsif $repository_name != nil
83- $frontend.repository_name = $repository_name
84- end
85+if $repository_name != nil
86+ $frontend.repository_name = $repository_name
87 end
88
89-
90 if $bugzillaURL != nil
91 commentSubstitutions['\b[Bb](?:[Uu][Gg])?\s*[#:]?\s*\[?[0-9]+\]?'] = bugzillaSub
92 end
93@@ -1810,7 +1832,9 @@
94 if $jiraURL != nil
95 commentSubstitutions['\b[a-zA-Z]+-[0-9]+\b'] = jiraSub
96 end
97-if $ticketURL != nil
98+if $tracURL != nil
99+ commentSubstitutions['\b[Tt][Ii][Cc][Kk][Ee][Tt]\s*#?[0-9]+\b'] = tracSub
100+elsif $ticketURL != nil
101 commentSubstitutions['\b[Tt][Ii][Cc][Kk][Ee][Tt]\s*#?[0-9]+\b'] = ticketSub
102 end
103 if $issueURL != nil
This page took 0.517302 seconds and 4 git commands to generate.