| 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 # TODO(hinoka): Use logging. | 6 # TODO(hinoka): Use logging. |
| 7 | 7 |
| 8 import cStringIO | 8 import cStringIO |
| 9 import codecs | 9 import codecs |
| 10 import collections | 10 import collections |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 solutions, target_os, target_os_only, git_cache_dir)) | 703 solutions, target_os, target_os_only, git_cache_dir)) |
| 704 | 704 |
| 705 | 705 |
| 706 def gclient_sync(with_branch_heads, shallow): | 706 def gclient_sync(with_branch_heads, shallow): |
| 707 # We just need to allocate a filename. | 707 # We just need to allocate a filename. |
| 708 fd, gclient_output_file = tempfile.mkstemp(suffix='.json') | 708 fd, gclient_output_file = tempfile.mkstemp(suffix='.json') |
| 709 os.close(fd) | 709 os.close(fd) |
| 710 gclient_bin = 'gclient.bat' if sys.platform.startswith('win') else 'gclient' | 710 gclient_bin = 'gclient.bat' if sys.platform.startswith('win') else 'gclient' |
| 711 cmd = [gclient_bin, 'sync', '--verbose', '--reset', '--force', | 711 cmd = [gclient_bin, 'sync', '--verbose', '--reset', '--force', |
| 712 '--ignore_locks', '--output-json', gclient_output_file, | 712 '--ignore_locks', '--output-json', gclient_output_file, |
| 713 '--nohooks', '--noprehooks', '--delete_unversioned_trees'] | 713 '--nohooks', '--noprehooks', '--delete_unversioned_trees', |
| 714 '--fetch_timeout=1200'] |
| 714 if with_branch_heads: | 715 if with_branch_heads: |
| 715 cmd += ['--with_branch_heads'] | 716 cmd += ['--with_branch_heads'] |
| 716 if shallow: | 717 if shallow: |
| 717 cmd += ['--shallow'] | 718 cmd += ['--shallow'] |
| 718 | 719 |
| 719 try: | 720 try: |
| 720 call(*cmd, tries=1) | 721 call(*cmd, tries=1) |
| 721 except SubprocessFailed as e: | 722 except SubprocessFailed as e: |
| 722 # Throw a GclientSyncFailed exception so we can catch this independently. | 723 # Throw a GclientSyncFailed exception so we can catch this independently. |
| 723 raise GclientSyncFailed(e.message, e.code, e.output) | 724 raise GclientSyncFailed(e.message, e.code, e.output) |
| (...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1798 except Exception: | 1799 except Exception: |
| 1799 # Unexpected failure. | 1800 # Unexpected failure. |
| 1800 emit_flag(options.flag_file) | 1801 emit_flag(options.flag_file) |
| 1801 raise | 1802 raise |
| 1802 else: | 1803 else: |
| 1803 emit_flag(options.flag_file) | 1804 emit_flag(options.flag_file) |
| 1804 | 1805 |
| 1805 | 1806 |
| 1806 if __name__ == '__main__': | 1807 if __name__ == '__main__': |
| 1807 sys.exit(main()) | 1808 sys.exit(main()) |
| OLD | NEW |