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

Side by Side Diff: gclient_scm.py

Issue 14583004: Don't delete directories that have been superseded by a broader checkout. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 7 years, 7 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
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 """Returns true if the command exists.""" 162 """Returns true if the command exists."""
163 try: 163 try:
164 # We assume git is newer than 1.7. See: crbug.com/114483 164 # We assume git is newer than 1.7. See: crbug.com/114483
165 result, version = scm.GIT.AssertVersion('1.7') 165 result, version = scm.GIT.AssertVersion('1.7')
166 if not result: 166 if not result:
167 raise gclient_utils.Error('Git version is older than 1.7: %s' % version) 167 raise gclient_utils.Error('Git version is older than 1.7: %s' % version)
168 return result 168 return result
169 except OSError: 169 except OSError:
170 return False 170 return False
171 171
172 def GetCheckoutRoot(self):
173 return scm.GIT.GetCheckoutRoot(self.checkout_path)
174
172 def GetRevisionDate(self, revision): 175 def GetRevisionDate(self, revision):
173 """Returns the given revision's date in ISO-8601 format (which contains the 176 """Returns the given revision's date in ISO-8601 format (which contains the
174 time zone).""" 177 time zone)."""
175 # TODO(floitsch): get the time-stamp of the given revision and not just the 178 # TODO(floitsch): get the time-stamp of the given revision and not just the
176 # time-stamp of the currently checked out revision. 179 # time-stamp of the currently checked out revision.
177 return self._Capture(['log', '-n', '1', '--format=%ai']) 180 return self._Capture(['log', '-n', '1', '--format=%ai'])
178 181
179 @staticmethod 182 @staticmethod
180 def cleanup(options, args, file_list): 183 def cleanup(options, args, file_list):
181 """'Cleanup' the repo. 184 """'Cleanup' the repo.
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 def BinaryExists(): 906 def BinaryExists():
904 """Returns true if the command exists.""" 907 """Returns true if the command exists."""
905 try: 908 try:
906 result, version = scm.SVN.AssertVersion('1.4') 909 result, version = scm.SVN.AssertVersion('1.4')
907 if not result: 910 if not result:
908 raise gclient_utils.Error('SVN version is older than 1.4: %s' % version) 911 raise gclient_utils.Error('SVN version is older than 1.4: %s' % version)
909 return result 912 return result
910 except OSError: 913 except OSError:
911 return False 914 return False
912 915
916 def GetCheckoutRoot(self):
917 return scm.SVN.GetCheckoutRoot(self.checkout_path)
918
913 def GetRevisionDate(self, revision): 919 def GetRevisionDate(self, revision):
914 """Returns the given revision's date in ISO-8601 format (which contains the 920 """Returns the given revision's date in ISO-8601 format (which contains the
915 time zone).""" 921 time zone)."""
916 date = scm.SVN.Capture( 922 date = scm.SVN.Capture(
917 ['propget', '--revprop', 'svn:date', '-r', revision], 923 ['propget', '--revprop', 'svn:date', '-r', revision],
918 os.path.join(self.checkout_path, '.')) 924 os.path.join(self.checkout_path, '.'))
919 return date.strip() 925 return date.strip()
920 926
921 def cleanup(self, options, args, file_list): 927 def cleanup(self, options, args, file_list):
922 """Cleanup working copy.""" 928 """Cleanup working copy."""
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 new_command.append('--force') 1281 new_command.append('--force')
1276 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1282 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1277 new_command.extend(('--accept', 'theirs-conflict')) 1283 new_command.extend(('--accept', 'theirs-conflict'))
1278 elif options.manually_grab_svn_rev: 1284 elif options.manually_grab_svn_rev:
1279 new_command.append('--force') 1285 new_command.append('--force')
1280 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1286 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1281 new_command.extend(('--accept', 'postpone')) 1287 new_command.extend(('--accept', 'postpone'))
1282 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1288 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1283 new_command.extend(('--accept', 'postpone')) 1289 new_command.extend(('--accept', 'postpone'))
1284 return new_command 1290 return new_command
OLDNEW
« gclient.py ('K') | « gclient.py ('k') | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698