]> Cypherpunks repositories - gostls13.git/commitdiff
codereview: show LGTMs in hg p
authorRuss Cox <rsc@golang.org>
Wed, 19 Oct 2011 19:08:33 +0000 (15:08 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 19 Oct 2011 19:08:33 +0000 (15:08 -0400)
Shows first line of any response that the codereview server
has identified as an LGTM.  Example output below.

5305046:
        big: update for fmt interface changes

        Nothing terribly interesting here.

        Reviewer: gri@golang.org
                gri: LGTM
CC: golang-dev@googlegroups.com
        Files:
                src/pkg/big/int.go
                src/pkg/big/nat.go
                src/pkg/big/nat_test.go
                src/pkg/big/rat.go

5307044:
        exp/template/html: use rune

        Nothing terribly interesting here.

        Reviewer: mikesamuel@gmail.com, nigeltao@golang.org
                mikesamuel: I don't see a type def for rune.  Assuming that's a new intrinsic, LGTM.
CC: golang-dev@googlegroups.com
        Files:
                src/pkg/exp/template/html/css.go
                src/pkg/exp/template/html/css_test.go
                src/pkg/exp/template/html/html.go
                src/pkg/exp/template/html/js.go

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5297045

lib/codereview/codereview.py

index f96f75e2b9f438276318b6a37e7fbeb25029f023..b980929d588a93ec60da21ad6bbe2c098f7fac56 100644 (file)
@@ -230,6 +230,7 @@ class CL(object):
                self.copied_from = None # None means current user
                self.mailed = False
                self.private = False
+               self.lgtm = []
 
        def DiskText(self):
                cl = self
@@ -282,6 +283,8 @@ class CL(object):
                if cl.copied_from:
                        s += "\tAuthor: " + cl.copied_from + "\n"
                s += "\tReviewer: " + JoinComma(cl.reviewer) + "\n"
+               for (who, line) in cl.lgtm:
+                       s += "\t\t" + who + ": " + line + "\n"
                s += "\tCC: " + JoinComma(cl.cc) + "\n"
                s += "\tFiles:\n"
                for f in cl.files:
@@ -554,6 +557,13 @@ def LoadCL(ui, repo, name, web=True):
                cl.url = server_url_base + name
                cl.web = True
                cl.private = d.get('private', False) != False
+               cl.lgtm = []
+               for m in d.get('messages', []):
+                       if m.get('approval', False) == True:
+                               who = re.sub('@.*', '', m.get('sender', ''))
+                               text = re.sub("\n(.|\n)*", '', m.get('text', ''))
+                               cl.lgtm.append((who, text))
+
        set_status("loaded CL " + name)
        return cl, ''