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

Side by Side Diff: gclient_utils.py

Issue 164053003: Re-re-land gclient deletion of mismatching checkouts again (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Another attempt of gclient: delete mismatching checkouts Created 6 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 | « gclient_scm.py ('k') | scm.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) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 codecs 7 import codecs
8 import logging 8 import logging
9 import os 9 import os
10 import pipes 10 import pipes
11 import Queue 11 import Queue
12 import re 12 import re
13 import socket
13 import stat 14 import stat
14 import subprocess 15 import subprocess
15 import sys 16 import sys
16 import tempfile 17 import tempfile
17 import threading 18 import threading
18 import time 19 import time
19 import urlparse 20 import urlparse
20 21
21 import subprocess2 22 import subprocess2
22 23
23 24
24 RETRY_MAX = 3 25 RETRY_MAX = 3
25 RETRY_INITIAL_SLEEP = 0.5 26 RETRY_INITIAL_SLEEP = 0.5
26 27
27 28
29 def enable_deletion_of_conflicting_checkouts():
30 """Determines whether to enable new checkout deletion behavior.
31
32 Initially, enables the experimental functionality on a small set of
33 bots.
34 """
35 # TODO(borenet): Remove this hack as soon as we've verified that it
36 # doesn't cause the bots to break.
37 if not os.environ.get('CHROME_HEADLESS'):
38 return False
39 return socket.gethostname() in ('vm859-m1', 'BUILD1-M1',
40 'vm630-m1.golo.chromium.org')
41
42
28 class Error(Exception): 43 class Error(Exception):
29 """gclient exception class.""" 44 """gclient exception class."""
30 def __init__(self, msg, *args, **kwargs): 45 def __init__(self, msg, *args, **kwargs):
31 index = getattr(threading.currentThread(), 'index', 0) 46 index = getattr(threading.currentThread(), 'index', 0)
32 if index: 47 if index:
33 msg = '\n'.join('%d> %s' % (index, l) for l in msg.splitlines()) 48 msg = '\n'.join('%d> %s' % (index, l) for l in msg.splitlines())
34 super(Error, self).__init__(msg, *args, **kwargs) 49 super(Error, self).__init__(msg, *args, **kwargs)
35 50
36 51
37 def SplitUrlRevision(url): 52 def SplitUrlRevision(url):
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 965
951 Python on OSX 10.6 raises a NotImplementedError exception. 966 Python on OSX 10.6 raises a NotImplementedError exception.
952 """ 967 """
953 try: 968 try:
954 import multiprocessing 969 import multiprocessing
955 return multiprocessing.cpu_count() 970 return multiprocessing.cpu_count()
956 except: # pylint: disable=W0702 971 except: # pylint: disable=W0702
957 # Mac OS 10.6 only 972 # Mac OS 10.6 only
958 # pylint: disable=E1101 973 # pylint: disable=E1101
959 return int(os.sysconf('SC_NPROCESSORS_ONLN')) 974 return int(os.sysconf('SC_NPROCESSORS_ONLN'))
OLDNEW
« no previous file with comments | « gclient_scm.py ('k') | scm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698