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

Side by Side Diff: gclient_utils.py

Issue 27484002: Allow '.' in user name on gclient ssh connection (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 7 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
« 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) 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
(...skipping 15 matching lines...) Expand all
26 def __init__(self, msg, *args, **kwargs): 26 def __init__(self, msg, *args, **kwargs):
27 index = getattr(threading.currentThread(), 'index', 0) 27 index = getattr(threading.currentThread(), 'index', 0)
28 if index: 28 if index:
29 msg = '\n'.join('%d> %s' % (index, l) for l in msg.splitlines()) 29 msg = '\n'.join('%d> %s' % (index, l) for l in msg.splitlines())
30 super(Error, self).__init__(msg, *args, **kwargs) 30 super(Error, self).__init__(msg, *args, **kwargs)
31 31
32 def SplitUrlRevision(url): 32 def SplitUrlRevision(url):
33 """Splits url and returns a two-tuple: url, rev""" 33 """Splits url and returns a two-tuple: url, rev"""
34 if url.startswith('ssh:'): 34 if url.startswith('ssh:'):
35 # Make sure ssh://user-name@example.com/~/test.git@stable works 35 # Make sure ssh://user-name@example.com/~/test.git@stable works
36 regex = r'(ssh://(?:[-\w]+@)?[-\w:\.]+/[-~\w\./]+)(?:@(.+))?' 36 regex = r'(ssh://(?:[-.\w]+@)?[-\w:\.]+/[-~\w\./]+)(?:@(.+))?'
37 components = re.search(regex, url).groups() 37 components = re.search(regex, url).groups()
38 else: 38 else:
39 components = url.split('@', 1) 39 components = url.split('@', 1)
40 if len(components) == 1: 40 if len(components) == 1:
41 components += [None] 41 components += [None]
42 return tuple(components) 42 return tuple(components)
43 43
44 44
45 def IsDateRevision(revision): 45 def IsDateRevision(revision):
46 """Returns true if the given revision is of the form "{ ... }".""" 46 """Returns true if the given revision is of the form "{ ... }"."""
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 878
879 Python on OSX 10.6 raises a NotImplementedError exception. 879 Python on OSX 10.6 raises a NotImplementedError exception.
880 """ 880 """
881 try: 881 try:
882 import multiprocessing 882 import multiprocessing
883 return multiprocessing.cpu_count() 883 return multiprocessing.cpu_count()
884 except: # pylint: disable=W0702 884 except: # pylint: disable=W0702
885 # Mac OS 10.6 only 885 # Mac OS 10.6 only
886 # pylint: disable=E1101 886 # pylint: disable=E1101
887 return int(os.sysconf('SC_NPROCESSORS_ONLN')) 887 return int(os.sysconf('SC_NPROCESSORS_ONLN'))
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