OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 """A git command for managing a local cache of git repositories.""" | 6 """A git command for managing a local cache of git repositories.""" |
7 | 7 |
8 import errno | 8 import errno |
9 import logging | 9 import logging |
10 import optparse | 10 import optparse |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 filter_fn = lambda l: '[up to date]' not in l | 174 filter_fn = lambda l: '[up to date]' not in l |
175 if options.verbose: | 175 if options.verbose: |
176 v = ['-v', '--progress'] | 176 v = ['-v', '--progress'] |
177 filter_fn = None | 177 filter_fn = None |
178 | 178 |
179 d = [] | 179 d = [] |
180 if options.depth: | 180 if options.depth: |
181 d = ['--depth', '%d' % options.depth] | 181 d = ['--depth', '%d' % options.depth] |
182 | 182 |
183 def _config(directory): | 183 def _config(directory): |
184 RunGit(['config', 'core.deltaBaseCacheLimit', '2g'], | 184 RunGit(['config', 'core.deltaBaseCacheLimit', |
185 cwd=directory) | 185 gclient_utils.DefaultDeltaBaseCacheLimit()], cwd=directory) |
186 RunGit(['config', 'remote.origin.url', url], | 186 RunGit(['config', 'remote.origin.url', url], |
187 cwd=directory) | 187 cwd=directory) |
188 RunGit(['config', '--replace-all', 'remote.origin.fetch', | 188 RunGit(['config', '--replace-all', 'remote.origin.fetch', |
189 '+refs/heads/*:refs/heads/*'], | 189 '+refs/heads/*:refs/heads/*'], |
190 cwd=directory) | 190 cwd=directory) |
191 RunGit(['config', '--add', 'remote.origin.fetch', | 191 RunGit(['config', '--add', 'remote.origin.fetch', |
192 '+refs/tags/*:refs/tags/*'], | 192 '+refs/tags/*:refs/tags/*'], |
193 cwd=directory) | 193 cwd=directory) |
194 for ref in options.ref or []: | 194 for ref in options.ref or []: |
195 ref = ref.rstrip('/') | 195 ref = ref.rstrip('/') |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 return options, args | 305 return options, args |
306 | 306 |
307 | 307 |
308 def main(argv): | 308 def main(argv): |
309 dispatcher = subcommand.CommandDispatcher(__name__) | 309 dispatcher = subcommand.CommandDispatcher(__name__) |
310 return dispatcher.execute(OptionParser(), argv) | 310 return dispatcher.execute(OptionParser(), argv) |
311 | 311 |
312 | 312 |
313 if __name__ == '__main__': | 313 if __name__ == '__main__': |
314 sys.exit(main(sys.argv[1:])) | 314 sys.exit(main(sys.argv[1:])) |
OLD | NEW |