Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(465)

Side by Side Diff: git_cl/git_cl.py

Issue 6683035: Reland Usage of TERM to distinguish between msys and cygwin.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gcl.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # git-cl -- a git-command for integrating reviews on Rietveld 2 # git-cl -- a git-command for integrating reviews on Rietveld
3 # Copyright (C) 2008 Evan Martin <martine@danga.com> 3 # Copyright (C) 2008 Evan Martin <martine@danga.com>
4 4
5 import errno 5 import errno
6 import logging 6 import logging
7 import optparse 7 import optparse
8 import os 8 import os
9 import re 9 import re
10 import StringIO 10 import StringIO
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 """Given some starting text, let the user edit it and return the result.""" 705 """Given some starting text, let the user edit it and return the result."""
706 editor = os.getenv('EDITOR', 'vi') 706 editor = os.getenv('EDITOR', 'vi')
707 707
708 (file_handle, filename) = tempfile.mkstemp() 708 (file_handle, filename) = tempfile.mkstemp()
709 fileobj = os.fdopen(file_handle, 'w') 709 fileobj = os.fdopen(file_handle, 'w')
710 fileobj.write(starting_text) 710 fileobj.write(starting_text)
711 fileobj.close() 711 fileobj.close()
712 712
713 # Open up the default editor in the system to get the CL description. 713 # Open up the default editor in the system to get the CL description.
714 cmd = [editor, filename] 714 cmd = [editor, filename]
715 if sys.platform == 'win32' and 'mingw\\bin' in os.environ['PATH']: 715 if sys.platform == 'win32' and os.environ.get('TERM') == 'msys':
716 # Msysgit requires the usage of 'env' to be present. The only way to 716 # Msysgit requires the usage of 'env' to be present.
717 # accomplish that is by reading the environment variable for mingw\bin.
718 cmd.insert(0, 'env') 717 cmd.insert(0, 'env')
719 try: 718 try:
720 subprocess.check_call(cmd) 719 subprocess.check_call(cmd)
721 fileobj = open(filename) 720 fileobj = open(filename)
722 result = fileobj.read() 721 result = fileobj.read()
723 fileobj.close() 722 fileobj.close()
724 finally: 723 finally:
725 os.remove(filename) 724 os.remove(filename)
726 725
727 if not result: 726 if not result:
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 1412 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
1414 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 1413 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
1415 1414
1416 # Not a known command. Default to help. 1415 # Not a known command. Default to help.
1417 GenUsage(parser, 'help') 1416 GenUsage(parser, 'help')
1418 return CMDhelp(parser, argv) 1417 return CMDhelp(parser, argv)
1419 1418
1420 1419
1421 if __name__ == '__main__': 1420 if __name__ == '__main__':
1422 sys.exit(main(sys.argv[1:])) 1421 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « gcl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698