| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import cStringIO | 6 import cStringIO |
| 7 import os | 7 import os |
| 8 import re | 8 import re |
| 9 import subprocess | 9 import subprocess |
| 10 import sys | 10 import sys |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 return Git(None, cmd, is_mirror=is_mirror, out_buffer=out_buffer) | 149 return Git(None, cmd, is_mirror=is_mirror, out_buffer=out_buffer) |
| 150 | 150 |
| 151 | 151 |
| 152 def PopulateCache(git_url, shallow=False): | 152 def PopulateCache(git_url, shallow=False): |
| 153 # --shallow by default checks out 10000 revision, but for really large | 153 # --shallow by default checks out 10000 revision, but for really large |
| 154 # repos like adobe ones, we want significantly less than 10000. | 154 # repos like adobe ones, we want significantly less than 10000. |
| 155 depth = None | 155 depth = None |
| 156 if shallow and 'adobe' in git_url: | 156 if shallow and 'adobe' in git_url: |
| 157 depth = 10 | 157 depth = 10 |
| 158 mirror = git_cache.Mirror(git_url, print_func=lambda *args: None) | 158 mirror = git_cache.Mirror(git_url, print_func=lambda *args: None) |
| 159 mirror.populate(depth=depth, shallow=shallow) | 159 mirror.populate(depth=depth, shallow=shallow, ignore_lock=True) |
| 160 return mirror.mirror_path | 160 return mirror.mirror_path |
| 161 | 161 |
| 162 | 162 |
| 163 def Fetch(git_repo, git_url, is_mirror): | 163 def Fetch(git_repo, git_url, is_mirror): |
| 164 """Fetch the latest objects for a given git repository.""" | 164 """Fetch the latest objects for a given git repository.""" |
| 165 # Always update the upstream url | 165 # Always update the upstream url |
| 166 Git(git_repo, 'config remote.origin.url %s' % git_url) | 166 Git(git_repo, 'config remote.origin.url %s' % git_url) |
| 167 Git(git_repo, 'fetch origin', is_mirror) | 167 Git(git_repo, 'fetch origin', is_mirror) |
| 168 | 168 |
| 169 | 169 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 regex = str(svn_rev) | 300 regex = str(svn_rev) |
| 301 return _SearchImpl(git_repo, svn_rev, is_mirror, refspec, fetch_url, regex) | 301 return _SearchImpl(git_repo, svn_rev, is_mirror, refspec, fetch_url, regex) |
| 302 | 302 |
| 303 | 303 |
| 304 def Search(git_repo, svn_rev, is_mirror, refspec='FETCH_HEAD', fetch_url=None): | 304 def Search(git_repo, svn_rev, is_mirror, refspec='FETCH_HEAD', fetch_url=None): |
| 305 """Return the Git commit id fuzzy matching the given SVN revision. | 305 """Return the Git commit id fuzzy matching the given SVN revision. |
| 306 | 306 |
| 307 If fetch_url is not None, will update repo if revision is newer.""" | 307 If fetch_url is not None, will update repo if revision is newer.""" |
| 308 regex = CreateLessThanOrEqualRegex(svn_rev) | 308 regex = CreateLessThanOrEqualRegex(svn_rev) |
| 309 return _SearchImpl(git_repo, svn_rev, is_mirror, refspec, fetch_url, regex) | 309 return _SearchImpl(git_repo, svn_rev, is_mirror, refspec, fetch_url, regex) |
| OLD | NEW |