OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """\ | 6 """\ |
7 Wrapper script around Rietveld's upload.py that simplifies working with groups | 7 Wrapper script around Rietveld's upload.py that simplifies working with groups |
8 of files. | 8 of files. |
9 """ | 9 """ |
10 | 10 |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1090 | 1090 |
1091 other_files = GetFilesNotInCL() | 1091 other_files = GetFilesNotInCL() |
1092 | 1092 |
1093 # Edited files (as opposed to files with only changed properties) will have | 1093 # Edited files (as opposed to files with only changed properties) will have |
1094 # a letter for the first character in the status string. | 1094 # a letter for the first character in the status string. |
1095 file_re = re.compile(r"^[a-z].+\Z", re.IGNORECASE) | 1095 file_re = re.compile(r"^[a-z].+\Z", re.IGNORECASE) |
1096 affected_files = [x for x in other_files if file_re.match(x[0])] | 1096 affected_files = [x for x in other_files if file_re.match(x[0])] |
1097 unaffected_files = [x for x in other_files if not file_re.match(x[0])] | 1097 unaffected_files = [x for x in other_files if not file_re.match(x[0])] |
1098 | 1098 |
1099 if not change_info.reviewers: | 1099 if not change_info.reviewers: |
1100 suggested_reviewers = suggest_reviewers(change_info, affected_files) | 1100 files_for_review = affected_files[:] |
1101 files_for_review.extend(change_info.GetFiles()) | |
1102 suggested_reviewers = suggest_reviewers(change_info, files_for_review) | |
1101 if suggested_reviewers: | 1103 if suggested_reviewers: |
1102 reviewers_re = re.compile(REVIEWERS_REGEX) | 1104 reviewers_re = re.compile(REVIEWERS_REGEX) |
1103 if not any( | 1105 if not any( |
1104 reviewers_re.match(l) for l in description.splitlines()): | 1106 reviewers_re.match(l) for l in description.splitlines()): |
M-A Ruel
2011/03/17 13:13:08
optional style nit: I'd rather this to save a line
Dirk Pranke
2011/03/17 18:44:38
Done.
| |
1105 description += '\nR=' + ','.join(suggested_reviewers) + '\n' | 1107 description += '\n\nR=' + ','.join(suggested_reviewers) |
1108 | |
1109 if not description.endswith('\n'): | |
M-A Ruel
2011/03/17 13:13:08
description = description.rstrip() + '\n'
Dirk Pranke
2011/03/17 18:44:38
Done.
| |
1110 description += '\n' | |
1106 | 1111 |
1107 separator1 = ("\n---All lines above this line become the description.\n" | 1112 separator1 = ("\n---All lines above this line become the description.\n" |
1108 "---Repository Root: " + change_info.GetLocalRoot() + "\n" | 1113 "---Repository Root: " + change_info.GetLocalRoot() + "\n" |
1109 "---Paths in this changelist (" + change_info.name + "):\n") | 1114 "---Paths in this changelist (" + change_info.name + "):\n") |
1110 separator2 = "\n\n---Paths modified but not in any changelist:\n\n" | 1115 separator2 = "\n\n---Paths modified but not in any changelist:\n\n" |
1111 text = (description + separator1 + '\n' + | 1116 text = (description + separator1 + '\n' + |
1112 '\n'.join([f[0] + f[1] for f in change_info.GetFiles()])) | 1117 '\n'.join([f[0] + f[1] for f in change_info.GetFiles()])) |
1113 | 1118 |
1114 if change_info.Exists(): | 1119 if change_info.Exists(): |
1115 text += (separator2 + | 1120 text += (separator2 + |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1462 if e.code != 500: | 1467 if e.code != 500: |
1463 raise | 1468 raise |
1464 print >> sys.stderr, ( | 1469 print >> sys.stderr, ( |
1465 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1470 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
1466 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) | 1471 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) |
1467 return 1 | 1472 return 1 |
1468 | 1473 |
1469 | 1474 |
1470 if __name__ == "__main__": | 1475 if __name__ == "__main__": |
1471 sys.exit(main(sys.argv[1:])) | 1476 sys.exit(main(sys.argv[1:])) |
OLD | NEW |