Chromium Code Reviews| Index: git_cl.py |
| diff --git a/git_cl.py b/git_cl.py |
| index dc351a2123a9f1bb29c2c7cf95806e7b4dcf7d1e..66eb310f8fb4980b157c51cd1dcaeae03dbd0a44 100755 |
| --- a/git_cl.py |
| +++ b/git_cl.py |
| @@ -858,24 +858,35 @@ class ChangeDescription(object): |
| return self._description |
| def update_reviewers(self, reviewers): |
| - """Rewrites the R=/TBR= line(s) as a single line.""" |
| + """Rewrites the R=/TBR= line(s) as a single line each.""" |
| assert isinstance(reviewers, list), reviewers |
| if not reviewers: |
| return |
| regexp = re.compile(self.R_LINE, re.MULTILINE) |
| matches = list(regexp.finditer(self._description)) |
| - is_tbr = any(m.group(1) == 'TBR' for m in matches) |
| + r_names = [] |
| + tbr_names = [] |
| + for line in matches: |
| + is_tbr = line.group(1) == 'TBR' |
| + people = cleanup_list([line.group(2).strip()]) |
| + if is_tbr: |
| + tbr_names += people |
| + else: |
| + r_names += people |
| if len(matches) > 1: |
| # Erase all except the first one. |
| for i in xrange(len(matches) - 1, 0, -1): |
| self._description = ( |
| self._description[:matches[i].start()] + |
| self._description[matches[i].end():]) |
| - |
| - if is_tbr: |
| - new_r_line = 'TBR=' + ', '.join(reviewers) |
| - else: |
| - new_r_line = 'R=' + ', '.join(reviewers) |
| + # Copy the names from the description into the official list. |
| + for name in r_names: |
| + if name not in reviewers: |
| + reviewers.append(name) |
| + |
| + new_r_line = 'R=' + ', '.join(reviewers) |
|
M-A Ruel
2013/08/23 15:22:53
I'd also skip it unless "if reviewers:"
agable
2013/08/23 18:43:00
I ended up refactoring most of the ChangeDescripti
|
| + if tbr_names: |
| + new_r_line += '\nTBR=' + ', '.join(tbr_names) |
| if matches: |
| self._description = ( |