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

Side by Side Diff: tests/gclient_scm_test.py

Issue 10355014: Make checkout.*.prepare() to delete the svn:ignored files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « scm.py ('k') | 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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Unit tests for gclient_scm.py.""" 6 """Unit tests for gclient_scm.py."""
7 7
8 # pylint: disable=E1103 8 # pylint: disable=E1103
9 9
10 # Import before super_mox to keep valid references. 10 # Import before super_mox to keep valid references.
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 relpath=self.relpath) 232 relpath=self.relpath)
233 scm.revert(options, self.args, files_list) 233 scm.revert(options, self.args, files_list)
234 self.checkstdout( 234 self.checkstdout(
235 '\n_____ %s is not a valid svn checkout, synching instead\n' % 235 '\n_____ %s is not a valid svn checkout, synching instead\n' %
236 self.relpath) 236 self.relpath)
237 237
238 def testRevertNone(self): 238 def testRevertNone(self):
239 options = self.Options(verbose=True) 239 options = self.Options(verbose=True)
240 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) 240 gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
241 gclient_scm.os.path.isdir(join(self.base_path, '.svn')).AndReturn(True) 241 gclient_scm.os.path.isdir(join(self.base_path, '.svn')).AndReturn(True)
242 gclient_scm.scm.SVN.CaptureStatus(None, self.base_path).AndReturn([]) 242 gclient_scm.scm.SVN.CaptureStatus(
243 None, self.base_path, no_ignore=False).AndReturn([])
243 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) 244 gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
244 gclient_scm.scm.SVN.RunAndGetFileList( 245 gclient_scm.scm.SVN.RunAndGetFileList(
245 options.verbose, 246 options.verbose,
246 ['update', '--revision', 'BASE', '--ignore-externals'], 247 ['update', '--revision', 'BASE', '--ignore-externals'],
247 cwd=self.base_path, 248 cwd=self.base_path,
248 file_list=mox.IgnoreArg()) 249 file_list=mox.IgnoreArg())
249 250
250 self.mox.ReplayAll() 251 self.mox.ReplayAll()
251 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, 252 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
252 relpath=self.relpath) 253 relpath=self.relpath)
253 file_list = [] 254 file_list = []
254 scm.revert(options, self.args, file_list) 255 scm.revert(options, self.args, file_list)
255 256
256 def testRevertDirectory(self): 257 def testRevertDirectory(self):
257 options = self.Options(verbose=True) 258 options = self.Options(verbose=True)
258 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) 259 gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
259 gclient_scm.os.path.isdir(join(self.base_path, '.svn')).AndReturn(True) 260 gclient_scm.os.path.isdir(join(self.base_path, '.svn')).AndReturn(True)
260 items = [ 261 items = [
261 ('~ ', 'a'), 262 ('~ ', 'a'),
262 ] 263 ]
263 gclient_scm.scm.SVN.CaptureStatus(None, self.base_path).AndReturn(items) 264 gclient_scm.scm.SVN.CaptureStatus(
265 None, self.base_path, no_ignore=False).AndReturn(items)
264 file_path = join(self.base_path, 'a') 266 file_path = join(self.base_path, 'a')
265 gclient_scm.os.path.exists(file_path).AndReturn(True) 267 gclient_scm.os.path.exists(file_path).AndReturn(True)
266 gclient_scm.os.path.isfile(file_path).AndReturn(False) 268 gclient_scm.os.path.isfile(file_path).AndReturn(False)
267 gclient_scm.os.path.islink(file_path).AndReturn(False) 269 gclient_scm.os.path.islink(file_path).AndReturn(False)
268 gclient_scm.os.path.isdir(file_path).AndReturn(True) 270 gclient_scm.os.path.isdir(file_path).AndReturn(True)
269 gclient_scm.gclient_utils.RemoveDirectory(file_path) 271 gclient_scm.gclient_utils.RemoveDirectory(file_path)
270 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) 272 gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
271 gclient_scm.scm.SVN.RunAndGetFileList( 273 gclient_scm.scm.SVN.RunAndGetFileList(
272 options.verbose, 274 options.verbose,
273 ['update', '--revision', 'BASE', '--ignore-externals'], 275 ['update', '--revision', 'BASE', '--ignore-externals'],
274 cwd=self.base_path, 276 cwd=self.base_path,
275 file_list=mox.IgnoreArg()) 277 file_list=mox.IgnoreArg())
276 278
277 self.mox.ReplayAll() 279 self.mox.ReplayAll()
278 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, 280 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
279 relpath=self.relpath) 281 relpath=self.relpath)
280 file_list2 = [] 282 file_list2 = []
281 scm.revert(options, self.args, file_list2) 283 scm.revert(options, self.args, file_list2)
282 self.checkstdout(('%s\n' % file_path)) 284 self.checkstdout(('%s\n' % file_path))
283 285
284 def testRevertDot(self): 286 def testRevertDot(self):
285 self.mox.StubOutWithMock(gclient_scm.SVNWrapper, 'update') 287 self.mox.StubOutWithMock(gclient_scm.SVNWrapper, 'update')
286 options = self.Options(verbose=True) 288 options = self.Options(verbose=True)
287 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) 289 gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
288 gclient_scm.os.path.isdir(join(self.base_path, '.svn')).AndReturn(True) 290 gclient_scm.os.path.isdir(join(self.base_path, '.svn')).AndReturn(True)
289 items = [ 291 items = [
290 ('~ ', '.'), 292 ('~ ', '.'),
291 ] 293 ]
292 gclient_scm.scm.SVN.CaptureStatus(None, self.base_path).AndReturn(items) 294 gclient_scm.scm.SVN.CaptureStatus(
295 None, self.base_path, no_ignore=False).AndReturn(items)
293 # RemoveDirectory() doesn't work on path ending with '.', like 'foo/.'. 296 # RemoveDirectory() doesn't work on path ending with '.', like 'foo/.'.
294 file_path = self.base_path 297 file_path = self.base_path
295 gclient_scm.os.path.exists(file_path).AndReturn(True) 298 gclient_scm.os.path.exists(file_path).AndReturn(True)
296 gclient_scm.os.path.isfile(file_path).AndReturn(False) 299 gclient_scm.os.path.isfile(file_path).AndReturn(False)
297 gclient_scm.os.path.islink(file_path).AndReturn(False) 300 gclient_scm.os.path.islink(file_path).AndReturn(False)
298 gclient_scm.os.path.isdir(file_path).AndReturn(True) 301 gclient_scm.os.path.isdir(file_path).AndReturn(True)
299 gclient_scm.gclient_utils.RemoveDirectory(file_path) 302 gclient_scm.gclient_utils.RemoveDirectory(file_path)
300 # pylint: disable=E1120 303 # pylint: disable=E1120
301 gclient_scm.os.path.isdir(self.base_path).AndReturn(False) 304 gclient_scm.os.path.isdir(self.base_path).AndReturn(False)
302 gclient_scm.SVNWrapper.update(options, [], ['.']) 305 gclient_scm.SVNWrapper.update(options, [], ['.'])
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 1224
1222 if __name__ == '__main__': 1225 if __name__ == '__main__':
1223 if '-v' in sys.argv: 1226 if '-v' in sys.argv:
1224 logging.basicConfig( 1227 logging.basicConfig(
1225 level=logging.DEBUG, 1228 level=logging.DEBUG,
1226 format='%(asctime).19s %(levelname)s %(filename)s:' 1229 format='%(asctime).19s %(levelname)s %(filename)s:'
1227 '%(lineno)s %(message)s') 1230 '%(lineno)s %(message)s')
1228 unittest.main() 1231 unittest.main()
1229 1232
1230 # vim: ts=2:sw=2:tw=80:et: 1233 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « scm.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698