Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: gclient.py

Issue 18328003: Add a git cache for gclient sync operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Fix comments Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gclient_scm.py » ('j') | gclient_scm.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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\'')
« no previous file with comments | « no previous file | gclient_scm.py » ('j') | gclient_scm.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698