OLD | NEW |
1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 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 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 return | 745 return |
746 | 746 |
747 # Get the existing scm url and the revision number of the current checkout. | 747 # Get the existing scm url and the revision number of the current checkout. |
748 from_info = scm.SVN.CaptureInfo(os.path.join(checkout_path, '.'), '.') | 748 from_info = scm.SVN.CaptureInfo(os.path.join(checkout_path, '.'), '.') |
749 if not from_info: | 749 if not from_info: |
750 raise gclient_utils.Error("Can't update/checkout %r if an unversioned " | 750 raise gclient_utils.Error("Can't update/checkout %r if an unversioned " |
751 "directory is present. Delete the directory " | 751 "directory is present. Delete the directory " |
752 "and try again." % | 752 "and try again." % |
753 checkout_path) | 753 checkout_path) |
754 | 754 |
| 755 # Look for locked directories. |
| 756 dir_info = scm.SVN.CaptureStatus(os.path.join(checkout_path, '.')) |
| 757 if [True for d in dir_info if d[0][2] == 'L' and d[1] == checkout_path]: |
| 758 # The current directory is locked, clean it up. |
| 759 scm.SVN.Run(['cleanup'], checkout_path) |
| 760 |
755 if options.manually_grab_svn_rev: | 761 if options.manually_grab_svn_rev: |
756 # Retrieve the current HEAD version because svn is slow at null updates. | 762 # Retrieve the current HEAD version because svn is slow at null updates. |
757 if not revision: | 763 if not revision: |
758 from_info_live = scm.SVN.CaptureInfo(from_info['URL'], '.') | 764 from_info_live = scm.SVN.CaptureInfo(from_info['URL'], '.') |
759 revision = str(from_info_live['Revision']) | 765 revision = str(from_info_live['Revision']) |
760 rev_str = ' at %s' % revision | 766 rev_str = ' at %s' % revision |
761 | 767 |
762 if from_info['URL'] != base_url: | 768 if from_info['URL'] != base_url: |
763 to_info = scm.SVN.CaptureInfo(url, '.') | 769 to_info = scm.SVN.CaptureInfo(url, '.') |
764 if not to_info.get('Repository Root') or not to_info.get('UUID'): | 770 if not to_info.get('Repository Root') or not to_info.get('UUID'): |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 command should be a list of strings that represents an svn command. | 934 command should be a list of strings that represents an svn command. |
929 | 935 |
930 This method returns a new list to be used as a command.""" | 936 This method returns a new list to be used as a command.""" |
931 new_command = command[:] | 937 new_command = command[:] |
932 if revision: | 938 if revision: |
933 new_command.extend(['--revision', str(revision).strip()]) | 939 new_command.extend(['--revision', str(revision).strip()]) |
934 # --force was added to 'svn update' in svn 1.5. | 940 # --force was added to 'svn update' in svn 1.5. |
935 if options.force and scm.SVN.AssertVersion("1.5")[0]: | 941 if options.force and scm.SVN.AssertVersion("1.5")[0]: |
936 new_command.append('--force') | 942 new_command.append('--force') |
937 return new_command | 943 return new_command |
OLD | NEW |