Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 IsDateRevision(revision): | 87 def IsDateRevision(revision): |
| 88 """Returns true if the given revision is of the form "{ ... }".""" | 88 """Returns true if the given revision is of the form "{ ... }".""" |
| 89 return bool(revision and re.match(r'^\{.+\}$', str(revision))) | 89 return bool(revision and re.match(r'^\{.+\}$', str(revision))) |
| 90 | 90 |
| 91 def IsGitSha(text): | |
|
wtc
2014/08/03 04:12:49
Nit: I know you listed IsGitSha after another IsXX
Primiano Tucci (use gerrit)
2014/08/03 17:43:34
Oh right, didn't realize that. Done.
| |
| 92 """Returns true if the given string is a valid hex-encoded sha""" | |
| 93 return re.match('^[a-fA-F0-9]{6,40}$', text) != None | |
| 91 | 94 |
| 92 def MakeDateRevision(date): | 95 def MakeDateRevision(date): |
| 93 """Returns a revision representing the latest revision before the given | 96 """Returns a revision representing the latest revision before the given |
| 94 date.""" | 97 date.""" |
| 95 return "{" + date + "}" | 98 return "{" + date + "}" |
| 96 | 99 |
| 97 | 100 |
| 98 def SyntaxErrorToError(filename, e): | 101 def SyntaxErrorToError(filename, e): |
| 99 """Raises a gclient_utils.Error exception with the human readable message""" | 102 """Raises a gclient_utils.Error exception with the human readable message""" |
| 100 try: | 103 try: |
| (...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1129 def DefaultIndexPackConfig(url=''): | 1132 def DefaultIndexPackConfig(url=''): |
| 1130 """Return reasonable default values for configuring git-index-pack. | 1133 """Return reasonable default values for configuring git-index-pack. |
| 1131 | 1134 |
| 1132 Experiments suggest that higher values for pack.threads don't improve | 1135 Experiments suggest that higher values for pack.threads don't improve |
| 1133 performance.""" | 1136 performance.""" |
| 1134 cache_limit = DefaultDeltaBaseCacheLimit() | 1137 cache_limit = DefaultDeltaBaseCacheLimit() |
| 1135 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit] | 1138 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit] |
| 1136 if url in THREADED_INDEX_PACK_BLACKLIST: | 1139 if url in THREADED_INDEX_PACK_BLACKLIST: |
| 1137 result.extend(['-c', 'pack.threads=1']) | 1140 result.extend(['-c', 'pack.threads=1']) |
| 1138 return result | 1141 return result |
| OLD | NEW |