| 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 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 '\n'.join([f[0] + f[1] for f in affected_files]) + '\n') | 1056 '\n'.join([f[0] + f[1] for f in affected_files]) + '\n') |
| 1057 else: | 1057 else: |
| 1058 text += ('\n'.join([f[0] + f[1] for f in affected_files]) + '\n' + | 1058 text += ('\n'.join([f[0] + f[1] for f in affected_files]) + '\n' + |
| 1059 separator2) | 1059 separator2) |
| 1060 text += '\n'.join([f[0] + f[1] for f in unaffected_files]) + '\n' | 1060 text += '\n'.join([f[0] + f[1] for f in unaffected_files]) + '\n' |
| 1061 | 1061 |
| 1062 handle, filename = tempfile.mkstemp(text=True) | 1062 handle, filename = tempfile.mkstemp(text=True) |
| 1063 os.write(handle, text) | 1063 os.write(handle, text) |
| 1064 os.close(handle) | 1064 os.close(handle) |
| 1065 | 1065 |
| 1066 result = None | |
| 1067 try: | 1066 try: |
| 1068 if not silent: | 1067 if not silent: |
| 1069 subprocess.check_call(['env', GetEditor(), filename], shell=True) | 1068 subprocess.check_call(['env', GetEditor(), filename]) |
| 1070 result = gclient_utils.FileRead(filename, 'r') | 1069 result = gclient_utils.FileRead(filename, 'r') |
| 1071 finally: | 1070 finally: |
| 1072 os.remove(filename) | 1071 os.remove(filename) |
| 1073 | 1072 |
| 1074 if not result: | 1073 if not result: |
| 1075 return 0 | 1074 return 0 |
| 1076 | 1075 |
| 1077 split_result = result.split(separator1, 1) | 1076 split_result = result.split(separator1, 1) |
| 1078 if len(split_result) != 2: | 1077 if len(split_result) != 2: |
| 1079 ErrorExit("Don't modify the text starting with ---!\n\n" + result) | 1078 ErrorExit("Don't modify the text starting with ---!\n\n" + result) |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1395 if e.code != 500: | 1394 if e.code != 500: |
| 1396 raise | 1395 raise |
| 1397 print >> sys.stderr, ( | 1396 print >> sys.stderr, ( |
| 1398 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1397 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
| 1399 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) | 1398 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) |
| 1400 return 1 | 1399 return 1 |
| 1401 | 1400 |
| 1402 | 1401 |
| 1403 if __name__ == "__main__": | 1402 if __name__ == "__main__": |
| 1404 sys.exit(main(sys.argv[1:])) | 1403 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |