Chromium Code Reviews| Index: gclient.py |
| diff --git a/gclient.py b/gclient.py |
| index 1f4801b9464af43a0bf9e252cde59053de0e23bf..bc92c009f13fadcc494a6976df91d22e3259fd70 100755 |
| --- a/gclient.py |
| +++ b/gclient.py |
| @@ -898,6 +898,7 @@ solutions = [ |
| "safesync_url": "%(safesync_url)s", |
| }, |
| ] |
| +cache_dir = %(cache_dir)r |
|
szager1
2013/07/03 16:49:52
str(None) == repr(None), so for the sake of consis
iannucci
2013/07/03 19:07:32
Ah, but str('foobar') != repr('foobar') :)
we nee
|
| """) |
| DEFAULT_SNAPSHOT_SOLUTION_TEXT = ("""\ |
| @@ -950,6 +951,9 @@ solutions = [ |
| else: |
| self._enforced_os = tuple(set(self._enforced_os).union(target_os)) |
| + gclient_scm.SCMWrapper.cache_dir = (gclient_scm.SCMWrapper.cache_dir or |
| + config_dict.get('cache_dir')) |
| + |
| if not target_os and config_dict.get('target_os_only', False): |
| raise gclient_utils.Error('Can\'t use target_os_only if target_os is ' |
| 'not specified') |
| @@ -1004,13 +1008,14 @@ solutions = [ |
| return client |
| def SetDefaultConfig(self, solution_name, deps_file, solution_url, |
| - safesync_url, managed=True): |
| + safesync_url, managed=True, cache_dir=None): |
| self.SetConfig(self.DEFAULT_CLIENT_FILE_TEXT % { |
| 'solution_name': solution_name, |
| 'solution_url': solution_url, |
| 'deps_file': deps_file, |
| 'safesync_url' : safesync_url, |
| 'managed': managed, |
| + 'cache_dir': cache_dir, |
| }) |
| def _SaveEntries(self): |
| @@ -1432,7 +1437,8 @@ URL. |
| if len(args) > 1: |
| safesync_url = args[1] |
| client.SetDefaultConfig(name, deps_file, base_url, safesync_url, |
| - managed=not options.unmanaged) |
| + managed=not options.unmanaged, |
| + cache_dir=options.cache_dir) |
| client.SaveConfig() |
| return 0 |
| @@ -1720,8 +1726,12 @@ def Parser(): |
| 'probably can\'t contain any newlines.') |
| parser.add_option('--no-nag-max', default=False, action='store_true', |
| help='If a subprocess runs for too long without generating' |
| - ' terminal output, generate warnings, but do not kill' |
| - ' the process.') |
| + ' terminal output, generate warnings, but do not kill' |
| + ' the process.') |
| + parser.add_option('--cache-dir', |
|
szager1
2013/07/03 16:49:52
I think I'd prefer that --cache-dir can only be sp
iannucci
2013/07/03 19:07:32
Fair enough.
|
| + help='(git only) Cache all repos into this dir and do ' |
| + 'shared clones from the cache, instead of cloning ' |
| + 'directly from the remote. (experimental)') |
| # Integrate standard options processing. |
| old_parser = parser.parse_args |
| def Parse(args): |
| @@ -1754,6 +1764,8 @@ def Parser(): |
| options.force = None |
| if options.no_nag_max: |
| gclient_scm.SCMWrapper.nag_max = None |
| + if options.cache_dir: |
| + gclient_scm.SCMWrapper.cache_dir = options.cache_dir |
| return (options, args) |
| parser.parse_args = Parse |
| # We don't want wordwrapping in epilog (usually examples) |