Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(408)

Side by Side Diff: gclient_scm.py

Issue 3132004: Ignore unversioned files when switching a repository. (Closed)
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 # TODO(maruel): TEST ME ! 786 # TODO(maruel): TEST ME !
787 command = ["switch", "--relocate", 787 command = ["switch", "--relocate",
788 from_info['Repository Root'], 788 from_info['Repository Root'],
789 to_info['Repository Root'], 789 to_info['Repository Root'],
790 self.relpath] 790 self.relpath]
791 scm.SVN.Run(command, self._root_dir) 791 scm.SVN.Run(command, self._root_dir)
792 from_info['URL'] = from_info['URL'].replace( 792 from_info['URL'] = from_info['URL'].replace(
793 from_info['Repository Root'], 793 from_info['Repository Root'],
794 to_info['Repository Root']) 794 to_info['Repository Root'])
795 else: 795 else:
796 if scm.SVN.CaptureStatus(checkout_path) and not options.force: 796 if not options.force:
797 raise gclient_utils.Error("Can't switch the checkout to %s; UUID " 797 # Look for local modifications but ignore unversioned files.
798 "don't match and there is local changes " 798 for status in scm.SVN.CaptureStatus(checkout_path):
799 "in %s. Delete the directory and " 799 if status[0] != '?':
800 "try again." % (url, checkout_path)) 800 raise gclient_utils.Error(
801 ('Can\'t switch the checkout to %s; UUID don\'t match and '
802 'there is local changes in %s. Delete the directory and '
803 'try again.') % (url, checkout_path))
801 # Ok delete it. 804 # Ok delete it.
802 print("\n_____ switching %s to a new checkout" % self.relpath) 805 print("\n_____ switching %s to a new checkout" % self.relpath)
803 gclient_utils.RemoveDirectory(checkout_path) 806 gclient_utils.RemoveDirectory(checkout_path)
804 # We need to checkout. 807 # We need to checkout.
805 command = ['checkout', url, checkout_path] 808 command = ['checkout', url, checkout_path]
806 command = self.AddAdditionalFlags(command, options, revision) 809 command = self.AddAdditionalFlags(command, options, revision)
807 scm.SVN.RunAndGetFileList(options, command, self._root_dir, file_list) 810 scm.SVN.RunAndGetFileList(options, command, self._root_dir, file_list)
808 return 811 return
809 812
810 813
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 command should be a list of strings that represents an svn command. 937 command should be a list of strings that represents an svn command.
935 938
936 This method returns a new list to be used as a command.""" 939 This method returns a new list to be used as a command."""
937 new_command = command[:] 940 new_command = command[:]
938 if revision: 941 if revision:
939 new_command.extend(['--revision', str(revision).strip()]) 942 new_command.extend(['--revision', str(revision).strip()])
940 # --force was added to 'svn update' in svn 1.5. 943 # --force was added to 'svn update' in svn 1.5.
941 if options.force and scm.SVN.AssertVersion("1.5")[0]: 944 if options.force and scm.SVN.AssertVersion("1.5")[0]:
942 new_command.append('--force') 945 new_command.append('--force')
943 return new_command 946 return new_command
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698