Index: mail.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/mail.py,v
retrieving revision 1.28
diff -u -r1.28 mail.py
--- mail.py	25 Sep 2006 02:43:56 -0000	1.28
+++ mail.py	21 Mar 2007 10:20:28 -0000
@@ -100,6 +100,7 @@
         @param mode: one of:
                      - 'all': send mail about all builds, passing and failing
                      - 'failing': only send mail about builds which fail
+                     - 'warnings': send mail about builds containing warnings
                      - 'problem': only send mail about a build which failed
                      when the previous build passed
 
@@ -206,21 +207,29 @@
                builder.category not in self.categories:
             return # ignore this build
 
-        if self.mode == "failing" and results != FAILURE:
-            return
-        if self.mode == "problem":
-            if results != FAILURE:
-                return
+        # Decide whether or not a message is to be sent
+        domail = False
+
+        if self.mode == "warnings" and (results == WARNINGS or results == FAILURE):
+            domail = True
+        if self.mode == "failing" and results == FAILURE:
+            domail = True
+        if self.mode == "problem" and results == FAILURE:
             prev = build.getPreviousBuild()
-            if prev and prev.getResults() == FAILURE:
-                return
+            if prev:
+                if prev.getResults() != FAILURE:
+                    domail = True
+            else:
+                domail = True
+
         # for testing purposes, buildMessage returns a Deferred that fires
         # when the mail has been sent. To help unit tests, we return that
         # Deferred here even though the normal IStatusReceiver.buildFinished
         # signature doesn't do anything with it. If that changes (if
         # .buildFinished's return value becomes significant), we need to
         # rearrange this.
-        return self.buildMessage(name, build, results)
+        if domail:
+            return self.buildMessage(name, build, results)
 
     def buildMessage(self, name, build, results):
         text = ""
@@ -228,8 +237,10 @@
             text += "The Buildbot has finished a build of %s.\n" % name
         elif self.mode == "failing":
             text += "The Buildbot has detected a failed build of %s.\n" % name
-        else:
+        elif self.mode == "problem":
             text += "The Buildbot has detected a new failure of %s.\n" % name
+        else:
+            text += "The Buildbot has detected warnings in %s.\n" % name
         buildurl = self.status.getURLForThing(build)
         if buildurl:
             text += "Full details are available at:\n %s\n" % buildurl
@@ -252,7 +263,7 @@
             if branch:
                 source += "[branch %s] " % branch
             if revision:
-                source += revision
+                source += str(revision)
             else:
                 source += "HEAD"
             if patch is not None:

