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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 # TODO(maruel): TEST ME ! | 793 # TODO(maruel): TEST ME ! |
794 command = ['switch', '--relocate', | 794 command = ['switch', '--relocate', |
795 from_info['Repository Root'], | 795 from_info['Repository Root'], |
796 to_info['Repository Root'], | 796 to_info['Repository Root'], |
797 self.relpath] | 797 self.relpath] |
798 scm.SVN.Run(command, self._root_dir) | 798 scm.SVN.Run(command, self._root_dir) |
799 from_info['URL'] = from_info['URL'].replace( | 799 from_info['URL'] = from_info['URL'].replace( |
800 from_info['Repository Root'], | 800 from_info['Repository Root'], |
801 to_info['Repository Root']) | 801 to_info['Repository Root']) |
802 else: | 802 else: |
803 if not options.force: | 803 if not options.force and not options.reset: |
804 # Look for local modifications but ignore unversioned files. | 804 # Look for local modifications but ignore unversioned files. |
805 for status in scm.SVN.CaptureStatus(checkout_path): | 805 for status in scm.SVN.CaptureStatus(checkout_path): |
806 if status[0] != '?': | 806 if status[0] != '?': |
807 raise gclient_utils.Error( | 807 raise gclient_utils.Error( |
808 ('Can\'t switch the checkout to %s; UUID don\'t match and ' | 808 ('Can\'t switch the checkout to %s; UUID don\'t match and ' |
809 'there is local changes in %s. Delete the directory and ' | 809 'there is local changes in %s. Delete the directory and ' |
810 'try again.') % (url, checkout_path)) | 810 'try again.') % (url, checkout_path)) |
811 # Ok delete it. | 811 # Ok delete it. |
812 print('\n_____ switching %s to a new checkout' % self.relpath) | 812 print('\n_____ switching %s to a new checkout' % self.relpath) |
813 gclient_utils.RemoveDirectory(checkout_path) | 813 gclient_utils.RemoveDirectory(checkout_path) |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 | 961 |
962 This method returns a new list to be used as a command.""" | 962 This method returns a new list to be used as a command.""" |
963 new_command = command[:] | 963 new_command = command[:] |
964 if revision: | 964 if revision: |
965 new_command.extend(['--revision', str(revision).strip()]) | 965 new_command.extend(['--revision', str(revision).strip()]) |
966 # --force was added to 'svn update' in svn 1.5. | 966 # --force was added to 'svn update' in svn 1.5. |
967 if ((options.force or options.manually_grab_svn_rev) and | 967 if ((options.force or options.manually_grab_svn_rev) and |
968 scm.SVN.AssertVersion("1.5")[0]): | 968 scm.SVN.AssertVersion("1.5")[0]): |
969 new_command.append('--force') | 969 new_command.append('--force') |
970 return new_command | 970 return new_command |
OLD | NEW |