Chromium Code Reviews| 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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 for d in dir_info: |
| 768 if d[0][2] == 'L': | 768 if d[0][2] == 'L': |
| 769 self._Run(['cleanup', d[1]], options) | 769 try: |
| 770 self._Run(['cleanup', d[1]], options) | |
| 771 except subprocess2.CalledProcessError, e: | |
| 772 # Only remove the directory automatically if it's not versioned | |
| 773 # and --force is used. | |
| 774 if d[0][0] in ('?', '!') and options.force: | |
|
M-A Ruel
2011/09/19 20:36:25
I don't see why you'd get the status '? L '.
I
Paweł Hajdan Jr.
2011/09/19 20:40:06
I was getting '! L '.
M-A Ruel
2011/09/19 20:43:59
In that case, it's because the root directory is n
| |
| 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 print 'If the directory is not versioned you can use --force.' | |
| 780 raise e | |
| 770 | 781 |
| 771 # Retrieve the current HEAD version because svn is slow at null updates. | 782 # Retrieve the current HEAD version because svn is slow at null updates. |
| 772 if options.manually_grab_svn_rev and not revision: | 783 if options.manually_grab_svn_rev and not revision: |
| 773 from_info_live = scm.SVN.CaptureInfo(from_info['URL']) | 784 from_info_live = scm.SVN.CaptureInfo(from_info['URL']) |
| 774 revision = str(from_info_live['Revision']) | 785 revision = str(from_info_live['Revision']) |
| 775 rev_str = ' at %s' % revision | 786 rev_str = ' at %s' % revision |
| 776 | 787 |
| 777 if from_info['URL'] != base_url: | 788 if from_info['URL'] != base_url: |
| 778 # The repository url changed, need to switch. | 789 # The repository url changed, need to switch. |
| 779 try: | 790 try: |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 939 | 950 |
| 940 This method returns a new list to be used as a command.""" | 951 This method returns a new list to be used as a command.""" |
| 941 new_command = command[:] | 952 new_command = command[:] |
| 942 if revision: | 953 if revision: |
| 943 new_command.extend(['--revision', str(revision).strip()]) | 954 new_command.extend(['--revision', str(revision).strip()]) |
| 944 # --force was added to 'svn update' in svn 1.5. | 955 # --force was added to 'svn update' in svn 1.5. |
| 945 if ((options.force or options.manually_grab_svn_rev) and | 956 if ((options.force or options.manually_grab_svn_rev) and |
| 946 scm.SVN.AssertVersion("1.5")[0]): | 957 scm.SVN.AssertVersion("1.5")[0]): |
| 947 new_command.append('--force') | 958 new_command.append('--force') |
| 948 return new_command | 959 return new_command |
| OLD | NEW |