Index: gclient.py |
diff --git a/gclient.py b/gclient.py |
index 1f4801b9464af43a0bf9e252cde59053de0e23bf..762e3142058915c4ebb3ae1087c550f28ac2175f 100755 |
--- a/gclient.py |
+++ b/gclient.py |
@@ -66,6 +66,7 @@ Specifying a target OS |
__version__ = "0.6.4" |
+import collections |
import copy |
import logging |
import optparse |
@@ -75,6 +76,7 @@ import posixpath |
import pprint |
import re |
import sys |
+import threading |
import urllib |
import urlparse |
@@ -1543,9 +1545,18 @@ def CMDsync(parser, args): |
'actual HEAD revision from the repository') |
parser.add_option('--upstream', action='store_true', |
help='Make repo state match upstream branch.') |
+ parser.add_option('--cache-dir', |
+ help='For git, cache all repos into this dir and do shared ' |
+ 'clones from the cache, instead of cloning directly ' |
+ 'from the remote. (experimental)') |
(options, args) = parser.parse_args(args) |
client = GClient.LoadCurrentConfig(options) |
+ if options.cache_dir: |
+ # If a given cache is used in a solution more than once, prevent multiple |
+ # threads from updating it simultaneously. |
+ options.cache_locks = collections.defaultdict(threading.Lock) |
+ |
if not client: |
raise gclient_utils.Error('client not configured; see \'gclient config\'') |