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

Side by Side Diff: gclient_utils.py

Issue 6719004: refactor parsing of change descriptions, fix TBR= (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: rebase to head, fix bugs 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') | git_cl/git_cl.py » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2010 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
11 import re 11 import re
12 import stat 12 import stat
13 import subprocess 13 import subprocess
14 import sys 14 import sys
15 import tempfile
15 import threading 16 import threading
16 import time 17 import time
17 import xml.dom.minidom 18 import xml.dom.minidom
18 import xml.parsers.expat 19 import xml.parsers.expat
19 20
20 21
21 def hack_subprocess(): 22 def hack_subprocess():
22 """subprocess functions may throw exceptions when used in multiple threads. 23 """subprocess functions may throw exceptions when used in multiple threads.
23 24
24 See http://bugs.python.org/issue1731717 for more information. 25 See http://bugs.python.org/issue1731717 for more information.
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 logging.info('Caught exception in thread %s' % self.item.name) 704 logging.info('Caught exception in thread %s' % self.item.name)
704 logging.info(str(sys.exc_info())) 705 logging.info(str(sys.exc_info()))
705 work_queue.exceptions.put(sys.exc_info()) 706 work_queue.exceptions.put(sys.exc_info())
706 logging.info('Task %s done' % self.item.name) 707 logging.info('Task %s done' % self.item.name)
707 708
708 work_queue.ready_cond.acquire() 709 work_queue.ready_cond.acquire()
709 try: 710 try:
710 work_queue.ready_cond.notifyAll() 711 work_queue.ready_cond.notifyAll()
711 finally: 712 finally:
712 work_queue.ready_cond.release() 713 work_queue.ready_cond.release()
714
715
716 def GetEditor():
717 editor = os.environ.get("SVN_EDITOR")
718 if not editor:
719 editor = os.environ.get("EDITOR")
720
721 if not editor:
722 if sys.platform.startswith("win"):
723 editor = "notepad"
724 else:
725 editor = "vi"
726
727 return editor
728
729
730 def UserEdit(text):
731 """Open an editor, edit the text, and return the result."""
732 (file_handle, filename) = tempfile.mkstemp()
733 fileobj = os.fdopen(file_handle, 'w')
734 fileobj.write(text)
735 fileobj.close()
736
737 # Open up the default editor in the system to get the CL description.
738 try:
739 cmd = '%s %s' % (GetEditor(), filename)
740 if sys.platform == 'win32' and os.environ.get('TERM') == 'msys':
741 # Msysgit requires the usage of 'env' to be present.
742 cmd = 'env ' + cmd
743 # shell=True to allow the shell to handle all forms of quotes in $EDITOR.
744 subprocess.check_call(cmd, shell=True)
745 return FileRead(filename, 'r')
746 finally:
747 os.remove(filename)
OLDNEW
« no previous file with comments | « gcl.py ('k') | git_cl/git_cl.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698