Ticket #2209: no_review.txt

File no_review.txt, 2.6 KB (added by sanxiyn, 8 years ago)
Line 
1diff --git a/master/buildbot/status/status_gerrit.py b/master/buildbot/status/status_gerrit.py
2index a9418a1..a82ab2c 100644
3--- a/master/buildbot/status/status_gerrit.py
4+++ b/master/buildbot/status/status_gerrit.py
5@@ -87,7 +87,7 @@ class GerritStatusPush(StatusReceiverMultiService):
6             downloaded = downloaded.split(" ")
7             if downloads and 2 * len(downloads) == len(downloaded):
8                 message, verified, reviewed = self.reviewCB(builderName, build, result, self.status, self.reviewArg)
9-                if message == None:
10+                if message is None:
11                     return
12                 for i in range(0, len(downloads)):
13                     try:
14@@ -108,6 +108,8 @@ class GerritStatusPush(StatusReceiverMultiService):
15             revision = build.getProperty("got_revision")
16             if project is not None and revision is not None:
17                 message, verified, reviewed = self.reviewCB(builderName, build, result, self.status, self.reviewArg)
18+                if message is None:
19+                    return
20                 self.sendCodeReview(project, revision, message, verified, reviewed)
21                 return
22 
23diff --git a/master/docs/manual/cfg-statustargets.rst b/master/docs/manual/cfg-statustargets.rst
24index 60d48aa..3209e31 100644
25--- a/master/docs/manual/cfg-statustargets.rst
26+++ b/master/docs/manual/cfg-statustargets.rst
27@@ -1343,8 +1343,12 @@ GerritStatusPush
28 ::
29 
30     from buildbot.status.status_gerrit import GerritStatusPush
31+    from buildbot.status.builder import Results, SUCCESS, RETRY
32 
33     def gerritReviewCB(builderName, build, result, status, arg):
34+        if result == RETRY:
35+            return None, 0, 0
36+
37         message =  "Buildbot finished compiling your patchset\n"
38         message += "on configuration: %s\n" % builderName
39         message += "The result is: %s\n" % Results[result].upper()
40@@ -1354,7 +1358,7 @@ GerritStatusPush
41             message += status.getURLForThing(build) + "\n"
42 
43         # message, verified, reviewed
44-        return message, (result == 0 or -1), 0
45+        return message, (result == SUCCESS or -1), 0
46 
47     c['buildbotURL'] = 'http://buildbot.example.com/'
48     c['status'].append(GerritStatusPush('127.0.0.1', 'buildbot',
49@@ -1362,6 +1366,8 @@ GerritStatusPush
50                                         reviewArg=c['buildbotURL']))
51 
52 GerritStatusPush sends review of the :class:`Change` back to the Gerrit server.
53+``reviewCB`` should return a tuple of message, verified, reviewed. If message
54+is ``None``, no review will be sent.
55 
56 .. [#] Apparently this is the same way http://buildd.debian.org displays build status
57