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

Side by Side Diff: git_cache.py

Issue 325903005: Have git_cache print out download progress when bootstrapping the git cache (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 from __future__ import print_function 8 from __future__ import print_function
9 import errno 9 import errno
10 import logging 10 import logging
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 ls_out_sorted = sorted(ls_out.splitlines()) 258 ls_out_sorted = sorted(ls_out.splitlines())
259 if not ls_out_sorted: 259 if not ls_out_sorted:
260 # This repo is not on Google Storage. 260 # This repo is not on Google Storage.
261 return False 261 return False
262 latest_checkout = ls_out_sorted[-1] 262 latest_checkout = ls_out_sorted[-1]
263 263
264 # Download zip file to a temporary directory. 264 # Download zip file to a temporary directory.
265 try: 265 try:
266 tempdir = tempfile.mkdtemp() 266 tempdir = tempfile.mkdtemp()
267 self.print('Downloading %s' % latest_checkout) 267 self.print('Downloading %s' % latest_checkout)
268 code, out, err = gsutil.check_call('cp', latest_checkout, tempdir) 268 code = gsutil.call('cp', latest_checkout, tempdir)
269 if code: 269 if code:
270 self.print('%s\n%s' % (out, err))
271 return False 270 return False
272 filename = os.path.join(tempdir, latest_checkout.split('/')[-1]) 271 filename = os.path.join(tempdir, latest_checkout.split('/')[-1])
273 272
274 # Unpack the file with 7z on Windows, unzip on linux, or fallback. 273 # Unpack the file with 7z on Windows, unzip on linux, or fallback.
275 if not python_fallback: 274 if not python_fallback:
276 if sys.platform.startswith('win'): 275 if sys.platform.startswith('win'):
277 cmd = ['7z', 'x', '-o%s' % directory, '-tzip', filename] 276 cmd = ['7z', 'x', '-o%s' % directory, '-tzip', filename]
278 else: 277 else:
279 cmd = ['unzip', filename, '-d', directory] 278 cmd = ['unzip', filename, '-d', directory]
280 retcode = subprocess.call(cmd) 279 retcode = subprocess.call(cmd)
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 return options, args 527 return options, args
529 528
530 529
531 def main(argv): 530 def main(argv):
532 dispatcher = subcommand.CommandDispatcher(__name__) 531 dispatcher = subcommand.CommandDispatcher(__name__)
533 return dispatcher.execute(OptionParser(), argv) 532 return dispatcher.execute(OptionParser(), argv)
534 533
535 534
536 if __name__ == '__main__': 535 if __name__ == '__main__':
537 sys.exit(main(sys.argv[1:])) 536 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698