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 if [True for d in dir_info | 767 for d in dir_info: |
768 if d[0][2] == 'L' and d[1] == self.checkout_path]: | 768 if d[0][2] == 'L': |
769 # The current directory is locked, clean it up. | 769 self._Run(['cleanup', d[1]], options) |
770 self._Run(['cleanup'], options) | |
771 | 770 |
772 # Retrieve the current HEAD version because svn is slow at null updates. | 771 # Retrieve the current HEAD version because svn is slow at null updates. |
773 if options.manually_grab_svn_rev and not revision: | 772 if options.manually_grab_svn_rev and not revision: |
774 from_info_live = scm.SVN.CaptureInfo(from_info['URL']) | 773 from_info_live = scm.SVN.CaptureInfo(from_info['URL']) |
775 revision = str(from_info_live['Revision']) | 774 revision = str(from_info_live['Revision']) |
776 rev_str = ' at %s' % revision | 775 rev_str = ' at %s' % revision |
777 | 776 |
778 if from_info['URL'] != base_url: | 777 if from_info['URL'] != base_url: |
779 # The repository url changed, need to switch. | 778 # The repository url changed, need to switch. |
780 try: | 779 try: |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 | 939 |
941 This method returns a new list to be used as a command.""" | 940 This method returns a new list to be used as a command.""" |
942 new_command = command[:] | 941 new_command = command[:] |
943 if revision: | 942 if revision: |
944 new_command.extend(['--revision', str(revision).strip()]) | 943 new_command.extend(['--revision', str(revision).strip()]) |
945 # --force was added to 'svn update' in svn 1.5. | 944 # --force was added to 'svn update' in svn 1.5. |
946 if ((options.force or options.manually_grab_svn_rev) and | 945 if ((options.force or options.manually_grab_svn_rev) and |
947 scm.SVN.AssertVersion("1.5")[0]): | 946 scm.SVN.AssertVersion("1.5")[0]): |
948 new_command.append('--force') | 947 new_command.append('--force') |
949 return new_command | 948 return new_command |
OLD | NEW |