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

Side by Side Diff: gclient_utils.py

Issue 8395005: Clarify error message in GCL. (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: Created 9 years, 2 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 | « no previous file | 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 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Generic utils.""" 5 """Generic utils."""
6 6
7 import errno 7 import errno
8 import logging 8 import logging
9 import os 9 import os
10 import Queue 10 import Queue
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 else: 704 else:
705 editor = 'vim' 705 editor = 'vim'
706 return editor 706 return editor
707 707
708 708
709 def RunEditor(content, git): 709 def RunEditor(content, git):
710 """Opens up the default editor in the system to get the CL description.""" 710 """Opens up the default editor in the system to get the CL description."""
711 file_handle, filename = tempfile.mkstemp(text=True) 711 file_handle, filename = tempfile.mkstemp(text=True)
712 # Make sure CRLF is handled properly by requiring none. 712 # Make sure CRLF is handled properly by requiring none.
713 if '\r' in content: 713 if '\r' in content:
714 print >> sys.stderr, ('!! Please remove \\r from your content !!') 714 print >> sys.stderr, (
715 '!! Please remove \\r from your change description !!')
715 fileobj = os.fdopen(file_handle, 'w') 716 fileobj = os.fdopen(file_handle, 'w')
716 # Still remove \r if present. 717 # Still remove \r if present.
717 fileobj.write(re.sub('\r?\n', '\n', content)) 718 fileobj.write(re.sub('\r?\n', '\n', content))
718 fileobj.close() 719 fileobj.close()
719 720
720 try: 721 try:
721 cmd = '%s %s' % (GetEditor(git), filename) 722 cmd = '%s %s' % (GetEditor(git), filename)
722 if sys.platform == 'win32' and os.environ.get('TERM') == 'msys': 723 if sys.platform == 'win32' and os.environ.get('TERM') == 'msys':
723 # Msysgit requires the usage of 'env' to be present. 724 # Msysgit requires the usage of 'env' to be present.
724 cmd = 'env ' + cmd 725 cmd = 'env ' + cmd
725 try: 726 try:
726 # shell=True to allow the shell to handle all forms of quotes in 727 # shell=True to allow the shell to handle all forms of quotes in
727 # $EDITOR. 728 # $EDITOR.
728 subprocess2.check_call(cmd, shell=True) 729 subprocess2.check_call(cmd, shell=True)
729 except subprocess2.CalledProcessError: 730 except subprocess2.CalledProcessError:
730 return None 731 return None
731 return FileRead(filename) 732 return FileRead(filename)
732 finally: 733 finally:
733 os.remove(filename) 734 os.remove(filename)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698