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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |