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

Side by Side Diff: gclient_scm.py

Issue 23875041: Added SafeRename to better handle problems with git processes locking directories. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Fixing comment formatting. Created 7 years, 3 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
« no previous file with comments | « no previous file | gclient_utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | gclient_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698