From c0523e1db9bffc6a799775aea891606b1235564d Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 19 Oct 2011 15:08:33 -0400 Subject: [PATCH] codereview: show LGTMs in hg p 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/codereview/codereview.py b/lib/codereview/codereview.py index f96f75e2b9f..b980929d588 100644 --- a/lib/codereview/codereview.py +++ b/lib/codereview/codereview.py @@ -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, ''