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 |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 try: | 866 try: |
867 self._Run(clone_cmd, options, cwd=self._root_dir, git_filter=True) | 867 self._Run(clone_cmd, options, cwd=self._root_dir, git_filter=True) |
868 break | 868 break |
869 except subprocess2.CalledProcessError as e: | 869 except subprocess2.CalledProcessError as e: |
870 gclient_utils.rmtree(os.path.join(tmp_dir, '.git')) | 870 gclient_utils.rmtree(os.path.join(tmp_dir, '.git')) |
871 if e.returncode != 128 or i == 2: | 871 if e.returncode != 128 or i == 2: |
872 raise | 872 raise |
873 print(str(e)) | 873 print(str(e)) |
874 print('Retrying...') | 874 print('Retrying...') |
875 gclient_utils.safe_makedirs(self.checkout_path) | 875 gclient_utils.safe_makedirs(self.checkout_path) |
876 os.rename(os.path.join(tmp_dir, '.git'), | 876 gclient_utils.safe_rename(os.path.join(tmp_dir, '.git'), |
877 os.path.join(self.checkout_path, '.git')) | 877 os.path.join(self.checkout_path, '.git')) |
878 finally: | 878 finally: |
879 if os.listdir(tmp_dir): | 879 if os.listdir(tmp_dir): |
880 print('\n_____ removing non-empty tmp dir %s' % tmp_dir) | 880 print('\n_____ removing non-empty tmp dir %s' % tmp_dir) |
881 gclient_utils.rmtree(tmp_dir) | 881 gclient_utils.rmtree(tmp_dir) |
882 if revision.startswith('refs/heads/'): | 882 if revision.startswith('refs/heads/'): |
883 self._Run( | 883 self._Run( |
884 ['checkout', '--quiet', revision.replace('refs/heads/', '')], options) | 884 ['checkout', '--quiet', revision.replace('refs/heads/', '')], options) |
885 else: | 885 else: |
886 # Squelch git's very verbose detached HEAD warning and use our own | 886 # Squelch git's very verbose detached HEAD warning and use our own |
887 self._Run(['checkout', '--quiet', revision], options) | 887 self._Run(['checkout', '--quiet', revision], options) |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1474 new_command.append('--force') | 1474 new_command.append('--force') |
1475 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1475 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1476 new_command.extend(('--accept', 'theirs-conflict')) | 1476 new_command.extend(('--accept', 'theirs-conflict')) |
1477 elif options.manually_grab_svn_rev: | 1477 elif options.manually_grab_svn_rev: |
1478 new_command.append('--force') | 1478 new_command.append('--force') |
1479 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1479 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1480 new_command.extend(('--accept', 'postpone')) | 1480 new_command.extend(('--accept', 'postpone')) |
1481 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1481 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1482 new_command.extend(('--accept', 'postpone')) | 1482 new_command.extend(('--accept', 'postpone')) |
1483 return new_command | 1483 return new_command |
OLD | NEW |