Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1039)

Unified Diff: git_cl.py

Issue 14265007: Fix R= line handling when there is no value and improve presubmit TAG line regex (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Also check no trigger on whitespace Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | presubmit_support.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index 961a4abb167e48aee8b939f43417394029c82816..ce7c6df12595df173b196555d64144ae51bb4493 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -798,7 +798,7 @@ def GetCodereviewSettingsInteractively():
class ChangeDescription(object):
"""Contains a parsed form of the change description."""
- R_LINE = r'^\s*(TBR|R)\s*=\s*(.+)\s*$'
+ R_LINE = r'^[ \t]*(TBR|R)[ \t]*=[ \t]*(.*?)[ \t]*$'
def __init__(self, description):
self._description = (description or '').strip()
@@ -820,7 +820,7 @@ class ChangeDescription(object):
for i in xrange(len(matches) - 1, 0, -1):
self._description = (
self._description[:matches[i].start()] +
- self._description[matches[i].end()+1:])
+ self._description[matches[i].end():])
if is_tbr:
new_r_line = 'TBR=' + ', '.join(reviewers)
@@ -830,7 +830,7 @@ class ChangeDescription(object):
if matches:
self._description = (
self._description[:matches[0].start()] + new_r_line +
- self._description[matches[0].end()+1:])
+ self._description[matches[0].end():]).strip()
else:
self.append_footer(new_r_line)
@@ -869,7 +869,7 @@ class ChangeDescription(object):
def get_reviewers(self):
"""Retrieves the list of reviewers."""
regexp = re.compile(self.R_LINE, re.MULTILINE)
- reviewers = [i.group(2) for i in regexp.finditer(self._description)]
+ reviewers = [i.group(2).strip() for i in regexp.finditer(self._description)]
return cleanup_list(reviewers)
« no previous file with comments | « no previous file | presubmit_support.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698