RCS file: /cvsroot/buildbot/buildbot/buildbot/status/mail.py,v
retrieving revision 1.28
diff -u -r1.28 mail.py
|
|
|
|
| 100 | 100 | @param mode: one of: |
| 101 | 101 | - 'all': send mail about all builds, passing and failing |
| 102 | 102 | - 'failing': only send mail about builds which fail |
| | 103 | - 'warnings': send mail about builds containing warnings |
| 103 | 104 | - 'problem': only send mail about a build which failed |
| 104 | 105 | when the previous build passed |
| 105 | 106 | |
| … |
… |
|
| 206 | 207 | builder.category not in self.categories: |
| 207 | 208 | return # ignore this build |
| 208 | 209 | |
| 209 | | if self.mode == "failing" and results != FAILURE: |
| 210 | | return |
| 211 | | if self.mode == "problem": |
| 212 | | if results != FAILURE: |
| 213 | | return |
| | 210 | # Decide whether or not a message is to be sent |
| | 211 | domail = False |
| | 212 | |
| | 213 | if self.mode == "warnings" and (results == WARNINGS or results == FAILURE): |
| | 214 | domail = True |
| | 215 | if self.mode == "failing" and results == FAILURE: |
| | 216 | domail = True |
| | 217 | if self.mode == "problem" and results == FAILURE: |
| 214 | 218 | prev = build.getPreviousBuild() |
| 215 | | if prev and prev.getResults() == FAILURE: |
| 216 | | return |
| | 219 | if prev: |
| | 220 | if prev.getResults() != FAILURE: |
| | 221 | domail = True |
| | 222 | else: |
| | 223 | domail = True |
| | 224 | |
| 217 | 225 | # for testing purposes, buildMessage returns a Deferred that fires |
| 218 | 226 | # when the mail has been sent. To help unit tests, we return that |
| 219 | 227 | # Deferred here even though the normal IStatusReceiver.buildFinished |
| 220 | 228 | # signature doesn't do anything with it. If that changes (if |
| 221 | 229 | # .buildFinished's return value becomes significant), we need to |
| 222 | 230 | # rearrange this. |
| 223 | | return self.buildMessage(name, build, results) |
| | 231 | if domail: |
| | 232 | return self.buildMessage(name, build, results) |
| 224 | 233 | |
| 225 | 234 | def buildMessage(self, name, build, results): |
| 226 | 235 | text = "" |
| … |
… |
|
| 228 | 237 | text += "The Buildbot has finished a build of %s.\n" % name |
| 229 | 238 | elif self.mode == "failing": |
| 230 | 239 | text += "The Buildbot has detected a failed build of %s.\n" % name |
| 231 | | else: |
| | 240 | elif self.mode == "problem": |
| 232 | 241 | text += "The Buildbot has detected a new failure of %s.\n" % name |
| | 242 | else: |
| | 243 | text += "The Buildbot has detected warnings in %s.\n" % name |
| 233 | 244 | buildurl = self.status.getURLForThing(build) |
| 234 | 245 | if buildurl: |
| 235 | 246 | text += "Full details are available at:\n %s\n" % buildurl |
| … |
… |
|
| 252 | 263 | if branch: |
| 253 | 264 | source += "[branch %s] " % branch |
| 254 | 265 | if revision: |
| 255 | | source += revision |
| | 266 | source += str(revision) |
| 256 | 267 | else: |
| 257 | 268 | source += "HEAD" |
| 258 | 269 | if patch is not None: |