]>
Commit | Line | Data |
---|---|---|
efaa2289 ER |
1 | Index: cvsspam.conf |
2 | =================================================================== | |
3 | --- cvsspam.conf (revision 223) | |
4 | +++ cvsspam.conf (revision 253) | |
5 | @@ -34,11 +34,19 @@ | |
6 | # | |
7 | # When $jiraURL is given, text of the form 'project-1234' will be linked | |
8 | # to this issue in JIRA. | |
9 | +# | |
10 | +# When $xplannerStoryURL, $xplannerIterationURL and $xplannerProjectURL are | |
11 | +# given, text of the form XS1234 will be linked to XPlanner stories; text of | |
12 | +# the form XI1234 will be linked to XPlanner iterations; and text of the form | |
13 | +# XP1234 will be linked to XPlanner projects. | |
14 | ||
15 | #$bugzillaURL = "http://bugzilla.mozilla.org/show_bug.cgi?id=%s" | |
16 | ||
17 | #$jiraURL = "http://jira.atlassian.com/secure/ViewIssue.jspa?key=%s" | |
18 | ||
19 | +#$xplannerStoryURL = "http://www.example.com/xplanner/do/view/userstory?oid=%s" | |
20 | +#$xplannerIterationURL = "http://www.example.com/xplanner/do/view/iteration?oid=%s" | |
21 | +#$xplannerProjectURL = "http://www.example.com/xplanner/do/view/project?oid=%s" | |
22 | ||
23 | # Link to Wiki systems | |
24 | # | |
25 | @@ -125,6 +133,15 @@ | |
26 | #$diff_ignore_keywords = true | |
27 | ||
28 | ||
29 | +# cvsdiff whitespace ignoring (Default: show whitespace-only changes) | |
30 | +# | |
31 | +# Whitespace-only changes can distract from the rest of a diff. Set this | |
32 | +# value to true to exclude changes in the amount of whitespace (adds the -b | |
33 | +# option to cvs diff). | |
34 | + | |
35 | +$diff_ignore_whitespace = true | |
36 | + | |
37 | + | |
38 | # $no_removed_file_diff and $no_added_file_diff | |
39 | # | |
40 | # Set both these options, and emails will only include diffs for files | |
41 | @@ -177,3 +194,13 @@ | |
42 | # them happy, you can say $files_in_subject = true here. | |
43 | ||
44 | #$files_in_subject = false | |
45 | + | |
46 | + | |
47 | + | |
48 | +# Email size limit (Default: around 2MB) | |
49 | +# | |
50 | +# When large changes are committed, large CVSspam emails can result. Here | |
51 | +# you can set the size of email that CVSspam is not allowed to append any | |
52 | +# more diffs onto. Specify the number of bytes. | |
53 | + | |
54 | +#$mail_size_limit = 2097152 | |
55 | Index: collect_diffs.rb | |
56 | =================================================================== | |
57 | --- collect_diffs.rb (revision 223) | |
58 | +++ collect_diffs.rb (revision 253) | |
f34e4066 ER |
59 | @@ -27,6 +27,13 @@ |
60 | $dirtemplate = "#cvsspam.#{Process.getpgrp}.#{Process.uid}" | |
61 | ||
62 | def find_data_dir | |
63 | + if $from_address | |
64 | + safe_from = make_fromaddr_safe_for_filename($from_address) | |
65 | + Dir["#{$tmpdir}/#{$dirtemplate}.#{safe_from}-*"].each do |dir| | |
66 | + stat = File.stat(dir) | |
67 | + return dir if stat.owned? | |
68 | + end | |
69 | + end | |
70 | Dir["#{$tmpdir}/#{$dirtemplate}-*"].each do |dir| | |
71 | stat = File.stat(dir) | |
72 | return dir if stat.owned? | |
73 | @@ -35,6 +42,14 @@ | |
74 | end | |
75 | ||
76 | ||
77 | +# transform any special / unexpected characters appearing in the argument to | |
78 | +# --from so that they will not cause problems if the value is inserted into | |
79 | +# a file or directory name | |
80 | +def make_fromaddr_safe_for_filename(addr) | |
81 | + addr.gsub(/[^a-zA-Z0-1.,_-]/, "_") | |
82 | +end | |
83 | + | |
84 | + | |
85 | def blah(msg) | |
86 | if $debug | |
87 | $stderr.puts "collect_diffs.rb: #{msg}" | |
88 | @@ -129,7 +144,14 @@ | |
89 | changes = Array.new | |
90 | i = 0 | |
91 | while i < cvs_info.length | |
92 | - changes << ChangeInfo.new(cvs_info[i], cvs_info[i+=1], cvs_info[i+=1]) | |
93 | + change_file = cvs_info[i] | |
94 | + # It's been reported, | |
95 | + # http://lists.badgers-in-foil.co.uk/pipermail/cvsspam-devel/2005-September/000380.html | |
96 | + # that sometimes the second revision number that CVS gives us contains a | |
97 | + # trailing newline character, so we strip ws from these values before use, | |
98 | + change_from = cvs_info[i+=1].strip | |
99 | + change_to = cvs_info[i+=1].strip | |
100 | + changes << ChangeInfo.new(change_file, change_from, change_to) | |
101 | i+=1 | |
102 | end | |
103 | return changes | |
104 | @@ -222,6 +244,7 @@ | |
105 | ||
106 | diff_cmd = Array.new << $cvs_prog << "-nq" << "diff" << "-Nu" | |
107 | diff_cmd << "-kk" if $diff_ignore_keywords | |
108 | + diff_cmd << "-b" if $diff_ignore_whitespace | |
109 | ||
110 | if change.isAddition | |
111 | file.write "#A " | |
112 | @@ -333,9 +356,11 @@ | |
113 | end | |
114 | ||
115 | $config = nil | |
116 | +$from_address = nil | |
117 | $cvs_prog = "cvs" | |
118 | $debug = false | |
119 | $diff_ignore_keywords = false | |
120 | +$diff_ignore_whitespace = false | |
121 | $task_keywords = [] | |
122 | ||
123 | unless ENV.has_key?('CVSROOT') | |
124 | @@ -387,6 +412,7 @@ | |
125 | end | |
126 | $config = arg if opt=="--config" | |
127 | $debug = true if opt == "--debug" | |
128 | + $from_address = arg if opt == "--from" | |
129 | end | |
130 | ||
131 | blah("CVSROOT is #{ENV['CVSROOT']}") | |
efaa2289 ER |
132 | Index: record_lastdir.rb |
133 | =================================================================== | |
134 | --- record_lastdir.rb (revision 223) | |
135 | +++ record_lastdir.rb (revision 253) | |
136 | @@ -4,7 +4,6 @@ | |
137 | # http://www.badgers-in-foil.co.uk/projects/cvsspam/ | |
138 | # Copyright (c) David Holroyd | |
139 | ||
140 | -$repositorydir = ARGV.shift | |
141 | ||
142 | $tmpdir = ENV["TMPDIR"] || "/tmp" | |
143 | ||
144 | @@ -19,6 +18,36 @@ | |
145 | nil | |
146 | end | |
147 | ||
148 | + | |
149 | +# transform any special / unexpected characters appearing in the argument to | |
150 | +# --from so that they will not cause problems if the value is inserted into | |
151 | +# a file or directory name | |
152 | +def make_fromaddr_safe_for_filename(addr) | |
153 | + addr.gsub(/[^a-zA-Z0-1.,_-]/, "_") | |
154 | +end | |
155 | + | |
156 | +# Option processing doesn't use GetoptLong (for the moment) bacause arguments | |
157 | +# given to this script by CVS include the names of committed files. It | |
158 | +# seems quite possible that one of those file names could begin with a '-' | |
159 | +# and therefore be treated by GetoptLong as a value which requires processing. | |
160 | +# This would probably result in an error. | |
161 | +# | |
162 | +# [That could be worked around by placing a '--' option (which tells GetoptLong | |
163 | +# to stop processing option arguments) at the very end of the arguments to | |
164 | +# record_lastdir.rb in commitinfo, but that's very easily forgotten, and isn't | |
165 | +# really backwards compatable with the behaviour of older CVSspam releases.] | |
166 | +if ARGV.first == "--from" | |
167 | + # we could, of course, be tricked, if the first committed file in the list | |
168 | + # happened to be named '--from' :S | |
169 | + | |
170 | + # drop the "--from" | |
171 | + ARGV.shift | |
172 | + # and use the value which was given following the option, | |
173 | + $dirtemplate << "." << make_fromaddr_safe_for_filename(ARGV.shift) | |
174 | +end | |
175 | + | |
176 | +$repositorydir = ARGV.shift | |
177 | + | |
178 | $datadir = find_data_dir() | |
179 | ||
180 | if $datadir==nil | |
181 | Index: project.xml | |
182 | =================================================================== | |
183 | Index: CREDITS | |
184 | =================================================================== | |
185 | --- CREDITS (revision 223) | |
186 | +++ CREDITS (revision 253) | |
187 | @@ -29,3 +29,10 @@ | |
188 |