| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Gclient-specific SCM-specific operations.""" | 5 """Gclient-specific SCM-specific operations.""" |
| 6 | 6 |
| 7 import collections | 7 import collections |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import posixpath | 10 import posixpath |
| 11 import re | 11 import re |
| 12 import sys | 12 import sys |
| 13 import tempfile | 13 import tempfile |
| 14 import threading | 14 import threading |
| 15 import time | 15 import time |
| 16 import traceback |
| 16 import urlparse | 17 import urlparse |
| 17 | 18 |
| 18 import download_from_google_storage | 19 import download_from_google_storage |
| 19 import gclient_utils | 20 import gclient_utils |
| 20 import scm | 21 import scm |
| 21 import subprocess2 | 22 import subprocess2 |
| 22 | 23 |
| 23 | 24 |
| 24 THIS_FILE_PATH = os.path.abspath(__file__) | 25 THIS_FILE_PATH = os.path.abspath(__file__) |
| 25 | 26 |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 gclient_utils.safe_makedirs(parent_dir) | 829 gclient_utils.safe_makedirs(parent_dir) |
| 829 tmp_dir = tempfile.mkdtemp( | 830 tmp_dir = tempfile.mkdtemp( |
| 830 prefix='_gclient_%s_' % os.path.basename(self.checkout_path), | 831 prefix='_gclient_%s_' % os.path.basename(self.checkout_path), |
| 831 dir=parent_dir) | 832 dir=parent_dir) |
| 832 try: | 833 try: |
| 833 clone_cmd.append(tmp_dir) | 834 clone_cmd.append(tmp_dir) |
| 834 self._Run(clone_cmd, options, cwd=self._root_dir, retry=True) | 835 self._Run(clone_cmd, options, cwd=self._root_dir, retry=True) |
| 835 gclient_utils.safe_makedirs(self.checkout_path) | 836 gclient_utils.safe_makedirs(self.checkout_path) |
| 836 gclient_utils.safe_rename(os.path.join(tmp_dir, '.git'), | 837 gclient_utils.safe_rename(os.path.join(tmp_dir, '.git'), |
| 837 os.path.join(self.checkout_path, '.git')) | 838 os.path.join(self.checkout_path, '.git')) |
| 839 except: |
| 840 traceback.print_exc(file=sys.stderr) |
| 841 raise |
| 838 finally: | 842 finally: |
| 839 if os.listdir(tmp_dir): | 843 if os.listdir(tmp_dir): |
| 840 print('\n_____ removing non-empty tmp dir %s' % tmp_dir) | 844 print('\n_____ removing non-empty tmp dir %s' % tmp_dir) |
| 841 gclient_utils.rmtree(tmp_dir) | 845 gclient_utils.rmtree(tmp_dir) |
| 842 if revision.startswith('refs/heads/'): | 846 if revision.startswith('refs/heads/'): |
| 843 self._Run( | 847 self._Run( |
| 844 ['checkout', '--quiet', revision.replace('refs/heads/', '')], options) | 848 ['checkout', '--quiet', revision.replace('refs/heads/', '')], options) |
| 845 else: | 849 else: |
| 846 # Squelch git's very verbose detached HEAD warning and use our own | 850 # Squelch git's very verbose detached HEAD warning and use our own |
| 847 self._Run(['checkout', '--quiet', revision], options) | 851 self._Run(['checkout', '--quiet', revision], options) |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 new_command.append('--force') | 1474 new_command.append('--force') |
| 1471 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1475 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1472 new_command.extend(('--accept', 'theirs-conflict')) | 1476 new_command.extend(('--accept', 'theirs-conflict')) |
| 1473 elif options.manually_grab_svn_rev: | 1477 elif options.manually_grab_svn_rev: |
| 1474 new_command.append('--force') | 1478 new_command.append('--force') |
| 1475 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1479 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1476 new_command.extend(('--accept', 'postpone')) | 1480 new_command.extend(('--accept', 'postpone')) |
| 1477 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1481 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1478 new_command.extend(('--accept', 'postpone')) | 1482 new_command.extend(('--accept', 'postpone')) |
| 1479 return new_command | 1483 return new_command |
| OLD | NEW |