| 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 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 # 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 result = None | |
| 1068 try: | 1067 try: |
| 1069 if not silent: | 1068 if not silent: |
| 1070 os.system(GetEditor() + " " + filename) | 1069 cmd = '%s %s' % (GetEditor(), filename) |
| 1070 if sys.platform == 'win32' and os.environ.get('TERM') == 'msys': |
| 1071 # Msysgit requires the usage of 'env' to be present. |
| 1072 cmd = 'env ' + cmd |
| 1073 # shell=True to allow the shell to handle all forms of quotes in $EDITOR. |
| 1074 subprocess.check_call(cmd, shell=True) |
| 1071 result = gclient_utils.FileRead(filename, 'r') | 1075 result = gclient_utils.FileRead(filename, 'r') |
| 1072 finally: | 1076 finally: |
| 1073 os.remove(filename) | 1077 os.remove(filename) |
| 1074 | 1078 |
| 1075 if not result: | 1079 if not result: |
| 1076 return 0 | 1080 return 0 |
| 1077 | 1081 |
| 1078 split_result = result.split(separator1, 1) | 1082 split_result = result.split(separator1, 1) |
| 1079 if len(split_result) != 2: | 1083 if len(split_result) != 2: |
| 1080 ErrorExit("Don't modify the text starting with ---!\n\n" + result) | 1084 ErrorExit("Don't modify the text starting with ---!\n\n" + result) |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 if e.code != 500: | 1400 if e.code != 500: |
| 1397 raise | 1401 raise |
| 1398 print >> sys.stderr, ( | 1402 print >> sys.stderr, ( |
| 1399 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1403 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
| 1400 '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)) |
| 1401 return 1 | 1405 return 1 |
| 1402 | 1406 |
| 1403 | 1407 |
| 1404 if __name__ == "__main__": | 1408 if __name__ == "__main__": |
| 1405 sys.exit(main(sys.argv[1:])) | 1409 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |