Chromium Code Reviews| 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 if not silent: | 1066 # Open up the default editor in the system to get the CL description. |
| 1067 os.system(GetEditor() + " " + filename) | 1067 # Msysgit requires the usage of 'env' to be present. The only way to |
| 1068 | 1068 # accomplish that is by reading the environment variable for mingw\bin. |
| 1069 result = gclient_utils.FileRead(filename, 'r') | 1069 cmd = [GetEditor(), filename] |
| 1070 os.remove(filename) | 1070 if sys.platform == 'win32': |
| 1071 msysgit_found = os.environ['PATH'].find('mingw\\bin') != -1 | |
|
M-A Ruel
2011/03/12 18:27:28
if sys.platform == 'win32' and 'mingw\\bin' in os.
Mohamed Mansour
2011/03/12 18:36:57
Done.
| |
| 1072 if msysgit_found: | |
| 1073 cmd.insert(0, 'env') | |
| 1074 try: | |
| 1075 if not silent: | |
| 1076 subprocess.check_call(cmd) | |
| 1077 result = gclient_utils.FileRead(filename, 'r') | |
| 1078 finally: | |
| 1079 os.remove(filename) | |
| 1071 | 1080 |
| 1072 if not result: | 1081 if not result: |
| 1073 return 0 | 1082 return 0 |
| 1074 | 1083 |
| 1075 split_result = result.split(separator1, 1) | 1084 split_result = result.split(separator1, 1) |
| 1076 if len(split_result) != 2: | 1085 if len(split_result) != 2: |
| 1077 ErrorExit("Don't modify the text starting with ---!\n\n" + result) | 1086 ErrorExit("Don't modify the text starting with ---!\n\n" + result) |
| 1078 | 1087 |
| 1079 # Update the CL description if it has changed. | 1088 # Update the CL description if it has changed. |
| 1080 new_description = split_result[0] | 1089 new_description = split_result[0] |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1393 if e.code != 500: | 1402 if e.code != 500: |
| 1394 raise | 1403 raise |
| 1395 print >> sys.stderr, ( | 1404 print >> sys.stderr, ( |
| 1396 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1405 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
| 1397 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) | 1406 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) |
| 1398 return 1 | 1407 return 1 |
| 1399 | 1408 |
| 1400 | 1409 |
| 1401 if __name__ == "__main__": | 1410 if __name__ == "__main__": |
| 1402 sys.exit(main(sys.argv[1:])) | 1411 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |