| 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 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 # Open up the default editor in the system to get the CL description. | 1066 # Open up the default editor in the system to get the CL description. |
| 1067 cmd = [GetEditor(), filename] | 1067 cmd = [GetEditor(), filename] |
| 1068 if sys.platform == 'win32' and os.environ['TERM'] == 'msys': | 1068 if sys.platform == 'win32' and 'mingw\\bin' in os.environ['PATH']: |
| 1069 # Msysgit requires the usage of 'env' to be present. | 1069 # Msysgit requires the usage of 'env' to be present. The only way to |
| 1070 # accomplish that is by reading the environment variable for mingw\bin. |
| 1070 cmd.insert(0, 'env') | 1071 cmd.insert(0, 'env') |
| 1071 try: | 1072 try: |
| 1072 if not silent: | 1073 if not silent: |
| 1073 subprocess.check_call(cmd) | 1074 subprocess.check_call(cmd) |
| 1074 result = gclient_utils.FileRead(filename, 'r') | 1075 result = gclient_utils.FileRead(filename, 'r') |
| 1075 finally: | 1076 finally: |
| 1076 os.remove(filename) | 1077 os.remove(filename) |
| 1077 | 1078 |
| 1078 if not result: | 1079 if not result: |
| 1079 return 0 | 1080 return 0 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1399 if e.code != 500: | 1400 if e.code != 500: |
| 1400 raise | 1401 raise |
| 1401 print >> sys.stderr, ( | 1402 print >> sys.stderr, ( |
| 1402 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1403 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
| 1403 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) | 1404 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) |
| 1404 return 1 | 1405 return 1 |
| 1405 | 1406 |
| 1406 | 1407 |
| 1407 if __name__ == "__main__": | 1408 if __name__ == "__main__": |
| 1408 sys.exit(main(sys.argv[1:])) | 1409 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |