summaryrefslogtreecommitdiff
path: root/lib/codereview/codereview.py
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-04-25 12:12:53 -0400
committerRuss Cox <rsc@golang.org>2011-04-25 12:12:53 -0400
commit1d6696183f835d89ef3be527ee50b588f72aad8c (patch)
tree0f3d4976f7aa5549bac79cd1dd1ddfedeccead03 /lib/codereview/codereview.py
parentcc40d29f97ebc86032046c92aea29cc04a4b6fd5 (diff)
downloadgo-1d6696183f835d89ef3be527ee50b588f72aad8c.tar.gz
codereview: various fixes
Set mailed bit correctly for self-clpatch. Use repo.rollback correctly. Allow leading spaces in some C code. R=golang-dev, r CC=golang-dev http://codereview.appspot.com/4438064
Diffstat (limited to 'lib/codereview/codereview.py')
-rw-r--r--lib/codereview/codereview.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/codereview/codereview.py b/lib/codereview/codereview.py
index 6e1d0b0d3..bfa69fcc0 100644
--- a/lib/codereview/codereview.py
+++ b/lib/codereview/codereview.py
@@ -997,7 +997,10 @@ def CheckTabfmt(ui, repo, files, just_warn):
for f in files:
try:
for line in open(f, 'r'):
- if line.startswith(' '):
+ # Four leading spaces is enough to complain about,
+ # except that some Plan 9 code uses four spaces as the label indent,
+ # so allow that.
+ if line.startswith(' ') and not re.match(' [A-Za-z0-9_]+:', line):
badfiles.append(f)
break
except:
@@ -1627,7 +1630,7 @@ def submit(ui, repo, *pats, **opts):
if r == 0:
raise util.Abort("local repository out of date; must sync before submit")
except:
- real_rollback(repo)
+ real_rollback()
raise
# we're committed. upload final patch, close review, add commit message
@@ -1916,6 +1919,16 @@ def IsRietveldSubmitted(ui, clname, hex):
return True
return False
+def IsRietveldMailed(ui, clname):
+ feed = XMLGet(ui, "/rss/issue/" + clname)
+ if feed is None:
+ return False
+ for sum in feed.findall("{http://www.w3.org/2005/Atom}entry/{http://www.w3.org/2005/Atom}summary"):
+ text = sum.text.strip()
+ if re.match("I'd like you to review this change", text):
+ return True
+ return False
+
def DownloadCL(ui, repo, clname):
set_status("downloading CL " + clname)
cl, err = LoadCL(ui, repo, clname)
@@ -1978,7 +1991,9 @@ def DownloadCL(ui, repo, clname):
# Print warning if email is not in CONTRIBUTORS file.
him = FindContributor(ui, repo, email)
me = FindContributor(ui, repo, None)
- if him != me:
+ if him == me:
+ cl.mailed = IsRietveldMailed(ui, clname)
+ else:
cl.copied_from = email
return cl, vers, diffdata, ""