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

Side by Side Diff: gclient_utils.py

Issue 440273002: Reland: Add --no-history option to fetch and gclient for shallow clones. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: ensure_value -> hasattr Created 6 years, 4 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_scm.py ('k') | tests/gclient_scm_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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 else: 77 else:
78 components = url.rsplit('@', 1) 78 components = url.rsplit('@', 1)
79 if re.match(r'^\w+\@', url) and '@' not in components[0]: 79 if re.match(r'^\w+\@', url) and '@' not in components[0]:
80 components = [url] 80 components = [url]
81 81
82 if len(components) == 1: 82 if len(components) == 1:
83 components += [None] 83 components += [None]
84 return tuple(components) 84 return tuple(components)
85 85
86 86
87 def IsGitSha(revision):
88 """Returns true if the given string is a valid hex-encoded sha"""
89 return re.match('^[a-fA-F0-9]{6,40}$', revision) is not None
90
91
87 def IsDateRevision(revision): 92 def IsDateRevision(revision):
88 """Returns true if the given revision is of the form "{ ... }".""" 93 """Returns true if the given revision is of the form "{ ... }"."""
89 return bool(revision and re.match(r'^\{.+\}$', str(revision))) 94 return bool(revision and re.match(r'^\{.+\}$', str(revision)))
90 95
91 96
92 def MakeDateRevision(date): 97 def MakeDateRevision(date):
93 """Returns a revision representing the latest revision before the given 98 """Returns a revision representing the latest revision before the given
94 date.""" 99 date."""
95 return "{" + date + "}" 100 return "{" + date + "}"
96 101
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 def DefaultIndexPackConfig(url=''): 1134 def DefaultIndexPackConfig(url=''):
1130 """Return reasonable default values for configuring git-index-pack. 1135 """Return reasonable default values for configuring git-index-pack.
1131 1136
1132 Experiments suggest that higher values for pack.threads don't improve 1137 Experiments suggest that higher values for pack.threads don't improve
1133 performance.""" 1138 performance."""
1134 cache_limit = DefaultDeltaBaseCacheLimit() 1139 cache_limit = DefaultDeltaBaseCacheLimit()
1135 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit] 1140 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit]
1136 if url in THREADED_INDEX_PACK_BLACKLIST: 1141 if url in THREADED_INDEX_PACK_BLACKLIST:
1137 result.extend(['-c', 'pack.threads=1']) 1142 result.extend(['-c', 'pack.threads=1'])
1138 return result 1143 return result
OLDNEW
« no previous file with comments | « gclient_scm.py ('k') | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698