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 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 else: | 1116 else: |
1117 text += ('\n'.join([f[0] + f[1] for f in affected_files]) + '\n' + | 1117 text += ('\n'.join([f[0] + f[1] for f in affected_files]) + '\n' + |
1118 separator2) | 1118 separator2) |
1119 text += '\n'.join([f[0] + f[1] for f in unaffected_files]) + '\n' | 1119 text += '\n'.join([f[0] + f[1] for f in unaffected_files]) + '\n' |
1120 | 1120 |
1121 handle, filename = tempfile.mkstemp(text=True) | 1121 handle, filename = tempfile.mkstemp(text=True) |
1122 os.write(handle, text) | 1122 os.write(handle, text) |
1123 os.close(handle) | 1123 os.close(handle) |
1124 | 1124 |
1125 # Open up the default editor in the system to get the CL description. | 1125 # Open up the default editor in the system to get the CL description. |
1126 result = None | |
1127 try: | 1126 try: |
1128 if not silent: | 1127 if not silent: |
1129 os.system(GetEditor() + " " + filename) | 1128 cmd = '%s %s' % (GetEditor(), filename) |
| 1129 if sys.platform == 'win32' and os.environ.get('TERM') == 'msys': |
| 1130 # Msysgit requires the usage of 'env' to be present. |
| 1131 cmd = 'env ' + cmd |
| 1132 # shell=True to allow the shell to handle all forms of quotes in $EDITOR. |
| 1133 subprocess.check_call(cmd, shell=True) |
1130 result = gclient_utils.FileRead(filename, 'r') | 1134 result = gclient_utils.FileRead(filename, 'r') |
1131 finally: | 1135 finally: |
1132 os.remove(filename) | 1136 os.remove(filename) |
1133 | 1137 |
1134 if not result: | 1138 if not result: |
1135 return 0 | 1139 return 0 |
1136 | 1140 |
1137 split_result = result.split(separator1, 1) | 1141 split_result = result.split(separator1, 1) |
1138 if len(split_result) != 2: | 1142 if len(split_result) != 2: |
1139 ErrorExit("Don't modify the text starting with ---!\n\n" + result) | 1143 ErrorExit("Don't modify the text starting with ---!\n\n" + result) |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 if e.code != 500: | 1461 if e.code != 500: |
1458 raise | 1462 raise |
1459 print >> sys.stderr, ( | 1463 print >> sys.stderr, ( |
1460 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1464 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
1461 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) | 1465 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) |
1462 return 1 | 1466 return 1 |
1463 | 1467 |
1464 | 1468 |
1465 if __name__ == "__main__": | 1469 if __name__ == "__main__": |
1466 sys.exit(main(sys.argv[1:])) | 1470 sys.exit(main(sys.argv[1:])) |
OLD | NEW |