OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 if change_info.issue: | 1038 if change_info.issue: |
1039 revision = re.compile(".*?\nCommitted revision (\d+)", | 1039 revision = re.compile(".*?\nCommitted revision (\d+)", |
1040 re.DOTALL).match(output).group(1) | 1040 re.DOTALL).match(output).group(1) |
1041 viewvc_url = GetCodeReviewSetting('VIEW_VC') | 1041 viewvc_url = GetCodeReviewSetting('VIEW_VC') |
1042 change_info.description += '\n' | 1042 change_info.description += '\n' |
1043 if viewvc_url and revision: | 1043 if viewvc_url and revision: |
1044 change_info.description += "\nCommitted: " + viewvc_url + revision | 1044 change_info.description += "\nCommitted: " + viewvc_url + revision |
1045 elif revision: | 1045 elif revision: |
1046 change_info.description += "\nCommitted: " + revision | 1046 change_info.description += "\nCommitted: " + revision |
1047 change_info.CloseIssue() | 1047 change_info.CloseIssue() |
1048 comment = "Committed manually as r%s" % revision | 1048 props = change_info.RpcServer().get_issue_properties(change_info.issue) |
| 1049 patch_num = len(props['patchsets']) |
| 1050 comment = "Committed patchset #%d manually as r%s" % (patch_num, revision) |
1049 comment += ' (presubmit successful).' if not bypassed else '.' | 1051 comment += ' (presubmit successful).' if not bypassed else '.' |
1050 change_info.AddComment(comment) | 1052 change_info.AddComment(comment) |
1051 return 0 | 1053 return 0 |
1052 | 1054 |
1053 | 1055 |
1054 def CMDchange(args): | 1056 def CMDchange(args): |
1055 """Creates or edits a changelist. | 1057 """Creates or edits a changelist. |
1056 | 1058 |
1057 Only scans the current directory and subdirectories. | 1059 Only scans the current directory and subdirectories. |
1058 """ | 1060 """ |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 file_re = re.compile(r"^[a-z].+\Z", re.IGNORECASE) | 1106 file_re = re.compile(r"^[a-z].+\Z", re.IGNORECASE) |
1105 affected_files = [x for x in other_files if file_re.match(x[0])] | 1107 affected_files = [x for x in other_files if file_re.match(x[0])] |
1106 unaffected_files = [x for x in other_files if not file_re.match(x[0])] | 1108 unaffected_files = [x for x in other_files if not file_re.match(x[0])] |
1107 | 1109 |
1108 description = description.rstrip() + '\n' | 1110 description = description.rstrip() + '\n' |
1109 | 1111 |
1110 separator1 = ("\n---All lines above this line become the description.\n" | 1112 separator1 = ("\n---All lines above this line become the description.\n" |
1111 "---Repository Root: " + change_info.GetLocalRoot() + "\n" | 1113 "---Repository Root: " + change_info.GetLocalRoot() + "\n" |
1112 "---Paths in this changelist (" + change_info.name + "):\n") | 1114 "---Paths in this changelist (" + change_info.name + "):\n") |
1113 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" |
1114 | 1116 |
1115 text = (description + separator1 + '\n' + | 1117 text = (description + separator1 + '\n' + |
1116 '\n'.join([f[0] + f[1] for f in change_info.GetFiles()])) | 1118 '\n'.join([f[0] + f[1] for f in change_info.GetFiles()])) |
1117 | 1119 |
1118 if change_info.Exists(): | 1120 if change_info.Exists(): |
1119 text += (separator2 + | 1121 text += (separator2 + |
1120 '\n'.join([f[0] + f[1] for f in affected_files]) + '\n') | 1122 '\n'.join([f[0] + f[1] for f in affected_files]) + '\n') |
1121 else: | 1123 else: |
1122 text += ('\n'.join([f[0] + f[1] for f in affected_files]) + '\n' + | 1124 text += ('\n'.join([f[0] + f[1] for f in affected_files]) + '\n' + |
1123 separator2) | 1125 separator2) |
1124 text += '\n'.join([f[0] + f[1] for f in unaffected_files]) + '\n' | 1126 text += '\n'.join([f[0] + f[1] for f in unaffected_files]) + '\n' |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 raise | 1469 raise |
1468 print >> sys.stderr, ( | 1470 print >> sys.stderr, ( |
1469 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1471 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
1470 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) | 1472 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) |
1471 return 1 | 1473 return 1 |
1472 | 1474 |
1473 | 1475 |
1474 if __name__ == "__main__": | 1476 if __name__ == "__main__": |
1475 fix_encoding.fix_encoding() | 1477 fix_encoding.fix_encoding() |
1476 sys.exit(main(sys.argv[1:])) | 1478 sys.exit(main(sys.argv[1:])) |
OLD | NEW |