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

Side by Side Diff: gclient_utils.py

Issue 233333003: Make it possible to refer to github-style URLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Added another test for the LateOverride to work correctly with scp-style urls. Created 6 years, 8 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 | « gclient.py ('k') | tests/gclient_test.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 cStringIO 8 import cStringIO
9 import datetime 9 import datetime
10 import logging 10 import logging
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 _WARNINGS.append(msg) 68 _WARNINGS.append(msg)
69 69
70 70
71 def SplitUrlRevision(url): 71 def SplitUrlRevision(url):
72 """Splits url and returns a two-tuple: url, rev""" 72 """Splits url and returns a two-tuple: url, rev"""
73 if url.startswith('ssh:'): 73 if url.startswith('ssh:'):
74 # Make sure ssh://user-name@example.com/~/test.git@stable works 74 # Make sure ssh://user-name@example.com/~/test.git@stable works
75 regex = r'(ssh://(?:[-.\w]+@)?[-\w:\.]+/[-~\w\./]+)(?:@(.+))?' 75 regex = r'(ssh://(?:[-.\w]+@)?[-\w:\.]+/[-~\w\./]+)(?:@(.+))?'
76 components = re.search(regex, url).groups() 76 components = re.search(regex, url).groups()
77 else: 77 else:
78 components = url.split('@', 1) 78 components = url.rsplit('@', 1)
79 if re.match(r'^\w+\@', url) and '@' not in components[0]:
80 components = [url]
81
79 if len(components) == 1: 82 if len(components) == 1:
80 components += [None] 83 components += [None]
81 return tuple(components) 84 return tuple(components)
82 85
83 86
84 def IsDateRevision(revision): 87 def IsDateRevision(revision):
85 """Returns true if the given revision is of the form "{ ... }".""" 88 """Returns true if the given revision is of the form "{ ... }"."""
86 return bool(revision and re.match(r'^\{.+\}$', str(revision))) 89 return bool(revision and re.match(r'^\{.+\}$', str(revision)))
87 90
88 91
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 def DefaultIndexPackConfig(url=''): 1080 def DefaultIndexPackConfig(url=''):
1078 """Return reasonable default values for configuring git-index-pack. 1081 """Return reasonable default values for configuring git-index-pack.
1079 1082
1080 Experiments suggest that higher values for pack.threads don't improve 1083 Experiments suggest that higher values for pack.threads don't improve
1081 performance.""" 1084 performance."""
1082 cache_limit = DefaultDeltaBaseCacheLimit() 1085 cache_limit = DefaultDeltaBaseCacheLimit()
1083 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit] 1086 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit]
1084 if url in THREADED_INDEX_PACK_BLACKLIST: 1087 if url in THREADED_INDEX_PACK_BLACKLIST:
1085 result.extend(['-c', 'pack.threads=1']) 1088 result.extend(['-c', 'pack.threads=1'])
1086 return result 1089 return result
OLDNEW
« no previous file with comments | « gclient.py ('k') | tests/gclient_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698