| 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 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 # TODO(maruel): TEST ME ! | 780 # TODO(maruel): TEST ME ! |
| 781 command = ["switch", "--relocate", | 781 command = ["switch", "--relocate", |
| 782 from_info['Repository Root'], | 782 from_info['Repository Root'], |
| 783 to_info['Repository Root'], | 783 to_info['Repository Root'], |
| 784 self.relpath] | 784 self.relpath] |
| 785 scm.SVN.Run(command, self._root_dir) | 785 scm.SVN.Run(command, self._root_dir) |
| 786 from_info['URL'] = from_info['URL'].replace( | 786 from_info['URL'] = from_info['URL'].replace( |
| 787 from_info['Repository Root'], | 787 from_info['Repository Root'], |
| 788 to_info['Repository Root']) | 788 to_info['Repository Root']) |
| 789 else: | 789 else: |
| 790 if scm.SVN.CaptureStatus(checkout_path): | 790 if scm.SVN.CaptureStatus(checkout_path) and not options.force: |
| 791 raise gclient_utils.Error("Can't switch the checkout to %s; UUID " | 791 raise gclient_utils.Error("Can't switch the checkout to %s; UUID " |
| 792 "don't match and there is local changes " | 792 "don't match and there is local changes " |
| 793 "in %s. Delete the directory and " | 793 "in %s. Delete the directory and " |
| 794 "try again." % (url, checkout_path)) | 794 "try again." % (url, checkout_path)) |
| 795 # Ok delete it. | 795 # Ok delete it. |
| 796 print("\n_____ switching %s to a new checkout" % self.relpath) | 796 print("\n_____ switching %s to a new checkout" % self.relpath) |
| 797 gclient_utils.RemoveDirectory(checkout_path) | 797 gclient_utils.RemoveDirectory(checkout_path) |
| 798 # We need to checkout. | 798 # We need to checkout. |
| 799 command = ['checkout', url, checkout_path] | 799 command = ['checkout', url, checkout_path] |
| 800 command = self.AddAdditionalFlags(command, options, revision) | 800 command = self.AddAdditionalFlags(command, options, revision) |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 command should be a list of strings that represents an svn command. | 929 command should be a list of strings that represents an svn command. |
| 930 | 930 |
| 931 This method returns a new list to be used as a command.""" | 931 This method returns a new list to be used as a command.""" |
| 932 new_command = command[:] | 932 new_command = command[:] |
| 933 if revision: | 933 if revision: |
| 934 new_command.extend(['--revision', str(revision).strip()]) | 934 new_command.extend(['--revision', str(revision).strip()]) |
| 935 # --force was added to 'svn update' in svn 1.5. | 935 # --force was added to 'svn update' in svn 1.5. |
| 936 if options.force and scm.SVN.AssertVersion("1.5")[0]: | 936 if options.force and scm.SVN.AssertVersion("1.5")[0]: |
| 937 new_command.append('--force') | 937 new_command.append('--force') |
| 938 return new_command | 938 return new_command |
| OLD | NEW |