OLD | NEW |
---|---|
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 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 logging | 7 import logging |
8 import os | 8 import os |
9 import posixpath | 9 import posixpath |
10 import re | 10 import re |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
757 # Get the existing scm url and the revision number of the current checkout. | 757 # Get the existing scm url and the revision number of the current checkout. |
758 try: | 758 try: |
759 from_info = scm.SVN.CaptureInfo(os.path.join(self.checkout_path, '.')) | 759 from_info = scm.SVN.CaptureInfo(os.path.join(self.checkout_path, '.')) |
760 except (gclient_utils.Error, subprocess2.CalledProcessError): | 760 except (gclient_utils.Error, subprocess2.CalledProcessError): |
761 raise gclient_utils.Error( | 761 raise gclient_utils.Error( |
762 ('Can\'t update/checkout %s if an unversioned directory is present. ' | 762 ('Can\'t update/checkout %s if an unversioned directory is present. ' |
763 'Delete the directory and try again.') % self.checkout_path) | 763 'Delete the directory and try again.') % self.checkout_path) |
764 | 764 |
765 # Look for locked directories. | 765 # Look for locked directories. |
766 dir_info = scm.SVN.CaptureStatus(os.path.join(self.checkout_path, '.')) | 766 dir_info = scm.SVN.CaptureStatus(os.path.join(self.checkout_path, '.')) |
767 for d in dir_info: | 767 needs_cleanup = any(d[0][2] == 'L' for d in dir_info) |
768 if d[0][2] == 'L': | 768 if needs_cleanup: |
M-A Ruel
2011/09/20 20:55:33
if any(d[0][2] == 'L' for d in dir_info):
| |
769 self._Run(['cleanup', d[1]], options) | 769 try: |
770 self._Run(['cleanup', self.checkout_path], options) | |
771 except subprocess2.CalledProcessError, e: | |
772 for d in dir_info: | |
M-A Ruel
2011/09/20 20:55:33
Add comment:
# Try to manually clean up each indiv
| |
773 if d[0][2] == 'L': | |
774 if d[0][0] == '!' and options.force: | |
775 print 'Removing troublesome path %s' % d[1] | |
776 gclient_utils.rmtree(d[1]) | |
777 else: | |
778 print 'Not removing troublesome path %s automatically.' % d[1] | |
779 if d[0][0] == '!': | |
780 print 'You can pass --force to enable automatic removal.' | |
781 raise e | |
770 | 782 |
771 # Retrieve the current HEAD version because svn is slow at null updates. | 783 # Retrieve the current HEAD version because svn is slow at null updates. |
772 if options.manually_grab_svn_rev and not revision: | 784 if options.manually_grab_svn_rev and not revision: |
773 from_info_live = scm.SVN.CaptureInfo(from_info['URL']) | 785 from_info_live = scm.SVN.CaptureInfo(from_info['URL']) |
774 revision = str(from_info_live['Revision']) | 786 revision = str(from_info_live['Revision']) |
775 rev_str = ' at %s' % revision | 787 rev_str = ' at %s' % revision |
776 | 788 |
777 if from_info['URL'] != base_url: | 789 if from_info['URL'] != base_url: |
778 # The repository url changed, need to switch. | 790 # The repository url changed, need to switch. |
779 try: | 791 try: |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
939 | 951 |
940 This method returns a new list to be used as a command.""" | 952 This method returns a new list to be used as a command.""" |
941 new_command = command[:] | 953 new_command = command[:] |
942 if revision: | 954 if revision: |
943 new_command.extend(['--revision', str(revision).strip()]) | 955 new_command.extend(['--revision', str(revision).strip()]) |
944 # --force was added to 'svn update' in svn 1.5. | 956 # --force was added to 'svn update' in svn 1.5. |
945 if ((options.force or options.manually_grab_svn_rev) and | 957 if ((options.force or options.manually_grab_svn_rev) and |
946 scm.SVN.AssertVersion("1.5")[0]): | 958 scm.SVN.AssertVersion("1.5")[0]): |
947 new_command.append('--force') | 959 new_command.append('--force') |
948 return new_command | 960 return new_command |
OLD | NEW |