OLD | NEW |
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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 '\n_____ %s is not a valid svn checkout, synching instead\n' % | 226 '\n_____ %s is not a valid svn checkout, synching instead\n' % |
227 self.relpath) | 227 self.relpath) |
228 | 228 |
229 def testRevertNone(self): | 229 def testRevertNone(self): |
230 options = self.Options(verbose=True) | 230 options = self.Options(verbose=True) |
231 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) | 231 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) |
232 gclient_scm.os.path.isdir(join(self.base_path, '.svn')).AndReturn(True) | 232 gclient_scm.os.path.isdir(join(self.base_path, '.svn')).AndReturn(True) |
233 gclient_scm.scm.SVN.CaptureStatus( | 233 gclient_scm.scm.SVN.CaptureStatus( |
234 None, self.base_path, no_ignore=False).AndReturn([]) | 234 None, self.base_path, no_ignore=False).AndReturn([]) |
235 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) | 235 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) |
236 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(['svn', | |
237 'cleanup', self.base_path], | |
238 always=True, cwd=self.base_path) | |
239 gclient_scm.scm.SVN.RunAndGetFileList( | 236 gclient_scm.scm.SVN.RunAndGetFileList( |
240 options.verbose, | 237 options.verbose, |
241 ['update', '--revision', 'BASE', '--ignore-externals'], | 238 ['update', '--revision', 'BASE', '--ignore-externals'], |
242 cwd=self.base_path, | 239 cwd=self.base_path, |
243 file_list=mox.IgnoreArg()) | 240 file_list=mox.IgnoreArg()) |
244 | 241 |
245 self.mox.ReplayAll() | 242 self.mox.ReplayAll() |
246 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 243 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
247 relpath=self.relpath) | 244 relpath=self.relpath) |
248 file_list = [] | 245 file_list = [] |
249 scm.revert(options, self.args, file_list) | 246 scm.revert(options, self.args, file_list) |
250 | 247 |
251 def testRevertDirectory(self): | 248 def testRevertDirectory(self): |
252 options = self.Options(verbose=True) | 249 options = self.Options(verbose=True) |
253 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) | 250 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) |
254 gclient_scm.os.path.isdir(join(self.base_path, '.svn')).AndReturn(True) | 251 gclient_scm.os.path.isdir(join(self.base_path, '.svn')).AndReturn(True) |
255 items = [ | 252 items = [ |
256 ('~ ', 'a'), | 253 ('~ ', 'a'), |
257 ] | 254 ] |
258 gclient_scm.scm.SVN.CaptureStatus( | 255 gclient_scm.scm.SVN.CaptureStatus( |
259 None, self.base_path, no_ignore=False).AndReturn(items) | 256 None, self.base_path, no_ignore=False).AndReturn(items) |
260 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(['svn', | |
261 'cleanup', self.base_path], | |
262 always=True, cwd=self.base_path) | |
263 file_path = join(self.base_path, 'a') | 257 file_path = join(self.base_path, 'a') |
264 gclient_scm.os.path.exists(file_path).AndReturn(True) | 258 gclient_scm.os.path.exists(file_path).AndReturn(True) |
265 gclient_scm.os.path.isfile(file_path).AndReturn(False) | 259 gclient_scm.os.path.isfile(file_path).AndReturn(False) |
266 gclient_scm.os.path.islink(file_path).AndReturn(False) | 260 gclient_scm.os.path.islink(file_path).AndReturn(False) |
267 gclient_scm.os.path.isdir(file_path).AndReturn(True) | 261 gclient_scm.os.path.isdir(file_path).AndReturn(True) |
268 gclient_scm.gclient_utils.rmtree(file_path) | 262 gclient_scm.gclient_utils.rmtree(file_path) |
269 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) | 263 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) |
270 gclient_scm.scm.SVN.RunAndGetFileList( | 264 gclient_scm.scm.SVN.RunAndGetFileList( |
271 options.verbose, | 265 options.verbose, |
272 ['update', '--revision', 'BASE', '--ignore-externals'], | 266 ['update', '--revision', 'BASE', '--ignore-externals'], |
(...skipping 19 matching lines...) Expand all Loading... |
292 None, self.base_path, no_ignore=False).AndReturn(items) | 286 None, self.base_path, no_ignore=False).AndReturn(items) |
293 # gclient_utils.rmtree() doesn't work on path ending with '.', like 'foo/.'. | 287 # gclient_utils.rmtree() doesn't work on path ending with '.', like 'foo/.'. |
294 file_path = self.base_path | 288 file_path = self.base_path |
295 gclient_scm.os.path.exists(file_path).AndReturn(True) | 289 gclient_scm.os.path.exists(file_path).AndReturn(True) |
296 gclient_scm.os.path.isfile(file_path).AndReturn(False) | 290 gclient_scm.os.path.isfile(file_path).AndReturn(False) |
297 gclient_scm.os.path.islink(file_path).AndReturn(False) | 291 gclient_scm.os.path.islink(file_path).AndReturn(False) |
298 gclient_scm.os.path.isdir(file_path).AndReturn(True) | 292 gclient_scm.os.path.isdir(file_path).AndReturn(True) |
299 gclient_scm.gclient_utils.rmtree(file_path) | 293 gclient_scm.gclient_utils.rmtree(file_path) |
300 # pylint: disable=E1120 | 294 # pylint: disable=E1120 |
301 gclient_scm.os.path.isdir(self.base_path).AndReturn(False) | 295 gclient_scm.os.path.isdir(self.base_path).AndReturn(False) |
302 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(['svn', | |
303 'cleanup', self.base_path], | |
304 always=True, cwd=self.base_path) | |
305 gclient_scm.SVNWrapper.update(options, [], ['.']) | 296 gclient_scm.SVNWrapper.update(options, [], ['.']) |
306 | 297 |
307 self.mox.ReplayAll() | 298 self.mox.ReplayAll() |
308 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 299 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
309 relpath=self.relpath) | 300 relpath=self.relpath) |
310 file_list2 = [] | 301 file_list2 = [] |
311 scm.revert(options, self.args, file_list2) | 302 scm.revert(options, self.args, file_list2) |
312 self.checkstdout(('%s\n' % os.path.join(file_path, '.'))) | 303 self.checkstdout(('%s\n' % os.path.join(file_path, '.'))) |
313 | 304 |
314 def testStatus(self): | 305 def testStatus(self): |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 } | 360 } |
370 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) | 361 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) |
371 self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsGitSvn', True) | 362 self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsGitSvn', True) |
372 gclient_scm.scm.GIT.IsGitSvn(self.base_path).AndReturn(False) | 363 gclient_scm.scm.GIT.IsGitSvn(self.base_path).AndReturn(False) |
373 gclient_scm.os.path.exists(self.base_path).AndReturn(True) | 364 gclient_scm.os.path.exists(self.base_path).AndReturn(True) |
374 | 365 |
375 # Checkout or update. | 366 # Checkout or update. |
376 dotted_path = join(self.base_path, '.') | 367 dotted_path = join(self.base_path, '.') |
377 gclient_scm.scm.SVN._CaptureInfo([], dotted_path).AndReturn(file_info) | 368 gclient_scm.scm.SVN._CaptureInfo([], dotted_path).AndReturn(file_info) |
378 | 369 |
| 370 # Verify no locked files. |
| 371 gclient_scm.scm.SVN.CaptureStatus(None, dotted_path).AndReturn([]) |
| 372 |
379 # Cheat a bit here. | 373 # Cheat a bit here. |
380 gclient_scm.scm.SVN._CaptureInfo([file_info['URL']], None | 374 gclient_scm.scm.SVN._CaptureInfo([file_info['URL']], None |
381 ).AndReturn(file_info) | 375 ).AndReturn(file_info) |
382 | 376 |
383 # _AddAdditionalUpdateFlags() | 377 # _AddAdditionalUpdateFlags() |
384 gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None | 378 gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None |
385 ).AndReturn('1.5.1') | 379 ).AndReturn('1.5.1') |
386 | 380 |
387 gclient_scm.scm.SVN._CaptureInfo([], self.base_path+'/.' | 381 gclient_scm.scm.SVN._CaptureInfo([], self.base_path+'/.' |
388 ).AndReturn({'Revision': 100}) | 382 ).AndReturn({'Revision': 100}) |
389 | 383 |
390 additional_args = [] | 384 additional_args = [] |
391 if options.manually_grab_svn_rev: | 385 if options.manually_grab_svn_rev: |
392 additional_args = ['--revision', str(file_info['Revision'])] | 386 additional_args = ['--revision', str(file_info['Revision'])] |
393 additional_args.extend(['--force', '--ignore-externals']) | 387 additional_args.extend(['--force', '--ignore-externals']) |
394 files_list = [] | 388 files_list = [] |
395 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(['svn', | |
396 'cleanup', self.base_path], | |
397 always=True, cwd=self.base_path) | |
398 gclient_scm.scm.SVN.RunAndGetFileList( | 389 gclient_scm.scm.SVN.RunAndGetFileList( |
399 options.verbose, | 390 options.verbose, |
400 ['update', self.base_path] + additional_args, | 391 ['update', self.base_path] + additional_args, |
401 cwd=self.root_dir, file_list=files_list) | 392 cwd=self.root_dir, file_list=files_list) |
402 | 393 |
403 self.mox.ReplayAll() | 394 self.mox.ReplayAll() |
404 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 395 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
405 relpath=self.relpath) | 396 relpath=self.relpath) |
406 scm.update(options, (), files_list) | 397 scm.update(options, (), files_list) |
407 | 398 |
408 def testUpdateReset(self): | 399 def testUpdateReset(self): |
409 options = self.Options(verbose=True) | 400 options = self.Options(verbose=True) |
410 options.reset = True | 401 options.reset = True |
411 file_info = { | 402 file_info = { |
412 'Repository Root': 'blah', | 403 'Repository Root': 'blah', |
413 'URL': self.url, | 404 'URL': self.url, |
414 'UUID': 'ABC', | 405 'UUID': 'ABC', |
415 'Revision': 42, | 406 'Revision': 42, |
416 } | 407 } |
417 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) | 408 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) |
418 self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsGitSvn', True) | 409 self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsGitSvn', True) |
419 gclient_scm.scm.GIT.IsGitSvn(self.base_path).AndReturn(False) | 410 gclient_scm.scm.GIT.IsGitSvn(self.base_path).AndReturn(False) |
420 gclient_scm.os.path.exists(self.base_path).AndReturn(True) | 411 gclient_scm.os.path.exists(self.base_path).AndReturn(True) |
421 | 412 |
422 # Checkout or update. | 413 # Checkout or update. |
423 dotted_path = join(self.base_path, '.') | 414 dotted_path = join(self.base_path, '.') |
424 gclient_scm.scm.SVN._CaptureInfo([], dotted_path).AndReturn(file_info) | 415 gclient_scm.scm.SVN._CaptureInfo([], dotted_path).AndReturn(file_info) |
425 | 416 |
426 # Create an untracked file and directory. | 417 # Create an untracked file and directory. |
| 418 gclient_scm.scm.SVN.CaptureStatus(None, dotted_path |
| 419 ).AndReturn([['? ', 'dir'], ['? ', 'file']]) |
| 420 |
427 gclient_scm.scm.SVN._CaptureInfo([file_info['URL']], None | 421 gclient_scm.scm.SVN._CaptureInfo([file_info['URL']], None |
428 ).AndReturn(file_info) | 422 ).AndReturn(file_info) |
429 | 423 |
430 gclient_scm.scm.SVN._CaptureInfo([], self.base_path+'/.' | 424 gclient_scm.scm.SVN._CaptureInfo([], self.base_path+'/.' |
431 ).AndReturn({'Revision': 100}) | 425 ).AndReturn({'Revision': 100}) |
432 | 426 |
433 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(['svn', | |
434 'cleanup', self.base_path], | |
435 always=True, cwd=self.base_path) | |
436 | |
437 self.mox.ReplayAll() | 427 self.mox.ReplayAll() |
438 files_list = [] | 428 files_list = [] |
439 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 429 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
440 relpath=self.relpath) | 430 relpath=self.relpath) |
441 scm.update(options, (), files_list) | 431 scm.update(options, (), files_list) |
442 self.checkstdout('_____ %s at 42\n' % self.relpath) | 432 self.checkstdout('_____ %s at 42\n' % self.relpath) |
443 | 433 |
444 def testUpdateResetDeleteUnversionedTrees(self): | 434 def testUpdateResetDeleteUnversionedTrees(self): |
445 options = self.Options(verbose=True) | 435 options = self.Options(verbose=True) |
446 options.reset = True | 436 options.reset = True |
447 options.delete_unversioned_trees = True | 437 options.delete_unversioned_trees = True |
448 | 438 |
449 file_info = { | 439 file_info = { |
450 'Repository Root': 'blah', | 440 'Repository Root': 'blah', |
451 'URL': self.url, | 441 'URL': self.url, |
452 'UUID': 'ABC', | 442 'UUID': 'ABC', |
453 'Revision': 42, | 443 'Revision': 42, |
454 } | 444 } |
455 | |
456 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) | 445 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) |
457 self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsGitSvn', True) | 446 self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsGitSvn', True) |
458 gclient_scm.scm.GIT.IsGitSvn(self.base_path).AndReturn(False) | 447 gclient_scm.scm.GIT.IsGitSvn(self.base_path).AndReturn(False) |
459 gclient_scm.os.path.exists(self.base_path).AndReturn(True) | 448 gclient_scm.os.path.exists(self.base_path).AndReturn(True) |
460 | 449 |
461 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(['svn', | |
462 'cleanup', self.base_path], | |
463 always=True, cwd=self.base_path) | |
464 | |
465 # Checkout or update. | 450 # Checkout or update. |
466 dotted_path = join(self.base_path, '.') | 451 dotted_path = join(self.base_path, '.') |
467 gclient_scm.scm.SVN._CaptureInfo([], dotted_path).AndReturn(file_info) | 452 gclient_scm.scm.SVN._CaptureInfo([], dotted_path).AndReturn(file_info) |
468 | 453 |
| 454 # Create an untracked file and directory. |
| 455 gclient_scm.scm.SVN.CaptureStatus(None, dotted_path |
| 456 ).AndReturn([['? ', 'dir'], ['? ', 'file']]) |
| 457 |
469 gclient_scm.scm.SVN._CaptureInfo([file_info['URL']], None | 458 gclient_scm.scm.SVN._CaptureInfo([file_info['URL']], None |
470 ).AndReturn(file_info) | 459 ).AndReturn(file_info) |
471 | 460 |
472 # Confirm that the untracked file is removed. | 461 # Confirm that the untracked file is removed. |
473 gclient_scm.scm.SVN.CaptureStatus(None, self.base_path | 462 gclient_scm.scm.SVN.CaptureStatus(None, self.base_path |
474 ).AndReturn([['? ', 'dir'], ['? ', 'file']]) | 463 ).AndReturn([['? ', 'dir'], ['? ', 'file']]) |
475 | |
476 gclient_scm.os.path.isdir(join(self.base_path, 'dir')).AndReturn(True) | 464 gclient_scm.os.path.isdir(join(self.base_path, 'dir')).AndReturn(True) |
477 gclient_scm.os.path.isdir(join(self.base_path, 'file')).AndReturn(False) | 465 gclient_scm.os.path.isdir(join(self.base_path, 'file')).AndReturn(False) |
478 gclient_scm.os.path.islink(join(self.base_path, 'dir')).AndReturn(False) | 466 gclient_scm.os.path.islink(join(self.base_path, 'dir')).AndReturn(False) |
479 gclient_scm.gclient_utils.rmtree(join(self.base_path, 'dir')) | 467 gclient_scm.gclient_utils.rmtree(join(self.base_path, 'dir')) |
480 | 468 |
481 gclient_scm.scm.SVN._CaptureInfo([], self.base_path+'/.' | 469 gclient_scm.scm.SVN._CaptureInfo([], self.base_path+'/.' |
482 ).AndReturn({'Revision': 100}) | 470 ).AndReturn({'Revision': 100}) |
483 | 471 |
484 self.mox.ReplayAll() | 472 self.mox.ReplayAll() |
485 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 473 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
(...skipping 11 matching lines...) Expand all Loading... |
497 'Revision': 42, | 485 'Revision': 42, |
498 } | 486 } |
499 | 487 |
500 # Checks to make sure that we support svn co --depth. | 488 # Checks to make sure that we support svn co --depth. |
501 gclient_scm.scm.SVN.current_version = None | 489 gclient_scm.scm.SVN.current_version = None |
502 gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None | 490 gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None |
503 ).AndReturn('1.5.1') | 491 ).AndReturn('1.5.1') |
504 gclient_scm.os.path.exists(join(self.base_path, '.svn')).AndReturn(False) | 492 gclient_scm.os.path.exists(join(self.base_path, '.svn')).AndReturn(False) |
505 gclient_scm.os.path.exists(join(self.base_path, 'DEPS')).AndReturn(False) | 493 gclient_scm.os.path.exists(join(self.base_path, 'DEPS')).AndReturn(False) |
506 | 494 |
| 495 # Verify no locked files. |
507 dotted_path = join(self.base_path, '.') | 496 dotted_path = join(self.base_path, '.') |
| 497 gclient_scm.scm.SVN.CaptureStatus(None, dotted_path).AndReturn([]) |
508 | 498 |
509 # When checking out a single file, we issue an svn checkout and svn update. | 499 # When checking out a single file, we issue an svn checkout and svn update. |
510 files_list = self.mox.CreateMockAnything() | 500 files_list = self.mox.CreateMockAnything() |
511 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( | 501 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( |
512 ['svn', 'checkout', '--depth', 'empty', self.url, self.base_path], | 502 ['svn', 'checkout', '--depth', 'empty', self.url, self.base_path], |
513 always=True, | 503 always=True, |
514 cwd=self.root_dir) | 504 cwd=self.root_dir) |
515 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(['svn', | |
516 'cleanup', self.base_path], | |
517 always=True, cwd=self.base_path) | |
518 gclient_scm.scm.SVN.RunAndGetFileList( | 505 gclient_scm.scm.SVN.RunAndGetFileList( |
519 options.verbose, | 506 options.verbose, |
520 ['update', 'DEPS', '--ignore-externals'], | 507 ['update', 'DEPS', '--ignore-externals'], |
521 cwd=self.base_path, | 508 cwd=self.base_path, |
522 file_list=files_list) | 509 file_list=files_list) |
523 | 510 |
524 # Now we fall back on scm.update(). | 511 # Now we fall back on scm.update(). |
525 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) | 512 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) |
526 self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsGitSvn', True) | 513 self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsGitSvn', True) |
527 gclient_scm.scm.GIT.IsGitSvn(self.base_path).AndReturn(False) | 514 gclient_scm.scm.GIT.IsGitSvn(self.base_path).AndReturn(False) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 # Checks to make sure that we support svn co --depth. | 556 # Checks to make sure that we support svn co --depth. |
570 gclient_scm.scm.SVN.current_version = None | 557 gclient_scm.scm.SVN.current_version = None |
571 gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None | 558 gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None |
572 ).AndReturn('1.5.1') | 559 ).AndReturn('1.5.1') |
573 gclient_scm.os.path.exists(join(self.base_path, '.svn')).AndReturn(False) | 560 gclient_scm.os.path.exists(join(self.base_path, '.svn')).AndReturn(False) |
574 # If DEPS already exists, assume we're upgrading from svn1.4, so delete | 561 # If DEPS already exists, assume we're upgrading from svn1.4, so delete |
575 # the old DEPS file. | 562 # the old DEPS file. |
576 gclient_scm.os.path.exists(join(self.base_path, 'DEPS')).AndReturn(True) | 563 gclient_scm.os.path.exists(join(self.base_path, 'DEPS')).AndReturn(True) |
577 gclient_scm.os.remove(join(self.base_path, 'DEPS')) | 564 gclient_scm.os.remove(join(self.base_path, 'DEPS')) |
578 | 565 |
| 566 # Verify no locked files. |
| 567 gclient_scm.scm.SVN.CaptureStatus( |
| 568 None, join(self.base_path, '.')).AndReturn([]) |
| 569 |
579 # When checking out a single file, we issue an svn checkout and svn update. | 570 # When checking out a single file, we issue an svn checkout and svn update. |
580 files_list = self.mox.CreateMockAnything() | 571 files_list = self.mox.CreateMockAnything() |
581 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( | 572 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( |
582 ['svn', 'checkout', '--depth', 'empty', self.url, self.base_path], | 573 ['svn', 'checkout', '--depth', 'empty', self.url, self.base_path], |
583 always=True, | 574 always=True, |
584 cwd=self.root_dir) | 575 cwd=self.root_dir) |
585 | |
586 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(['svn', | |
587 'cleanup', self.base_path], | |
588 always=True, cwd=self.base_path) | |
589 | |
590 gclient_scm.scm.SVN.RunAndGetFileList( | 576 gclient_scm.scm.SVN.RunAndGetFileList( |
591 options.verbose, | 577 options.verbose, |
592 ['update', 'DEPS', '--ignore-externals'], | 578 ['update', 'DEPS', '--ignore-externals'], |
593 cwd=self.base_path, | 579 cwd=self.base_path, |
594 file_list=files_list) | 580 file_list=files_list) |
595 | 581 |
596 # Now we fall back on scm.update(). | 582 # Now we fall back on scm.update(). |
597 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) | 583 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) |
598 self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsGitSvn', True) | 584 self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsGitSvn', True) |
599 gclient_scm.scm.GIT.IsGitSvn(self.base_path).AndReturn(False) | 585 gclient_scm.scm.GIT.IsGitSvn(self.base_path).AndReturn(False) |
(...skipping 18 matching lines...) Expand all Loading... |
618 file_info = { | 604 file_info = { |
619 'URL': self.url, | 605 'URL': self.url, |
620 'Revision': 42, | 606 'Revision': 42, |
621 } | 607 } |
622 # Checks to make sure that we support svn co --depth. | 608 # Checks to make sure that we support svn co --depth. |
623 gclient_scm.scm.SVN.current_version = None | 609 gclient_scm.scm.SVN.current_version = None |
624 gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None | 610 gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None |
625 ).AndReturn('1.5.1') | 611 ).AndReturn('1.5.1') |
626 gclient_scm.os.path.exists(join(self.base_path, '.svn')).AndReturn(True) | 612 gclient_scm.os.path.exists(join(self.base_path, '.svn')).AndReturn(True) |
627 | 613 |
628 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(['svn', | 614 # Verify no locked files. |
629 'cleanup', self.base_path], | 615 gclient_scm.scm.SVN.CaptureStatus(None, join(self.base_path, '.') |
630 always=True, cwd=self.base_path) | 616 ).AndReturn([]) |
631 | 617 |
632 # Now we fall back on scm.update(). | 618 # Now we fall back on scm.update(). |
633 files_list = self.mox.CreateMockAnything() | 619 files_list = self.mox.CreateMockAnything() |
634 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) | 620 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) |
635 self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsGitSvn', True) | 621 self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsGitSvn', True) |
636 gclient_scm.scm.GIT.IsGitSvn(self.base_path).AndReturn(False) | 622 gclient_scm.scm.GIT.IsGitSvn(self.base_path).AndReturn(False) |
637 gclient_scm.os.path.exists(self.base_path).AndReturn(True) | 623 gclient_scm.os.path.exists(self.base_path).AndReturn(True) |
638 gclient_scm.scm.SVN._CaptureInfo( | 624 gclient_scm.scm.SVN._CaptureInfo( |
639 [], join(self.base_path, '.')).AndReturn(file_info) | 625 [], join(self.base_path, '.')).AndReturn(file_info) |
640 gclient_scm.scm.SVN._CaptureInfo([file_info['URL']], None | 626 gclient_scm.scm.SVN._CaptureInfo([file_info['URL']], None |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 | 1374 |
1389 if __name__ == '__main__': | 1375 if __name__ == '__main__': |
1390 if '-v' in sys.argv: | 1376 if '-v' in sys.argv: |
1391 logging.basicConfig( | 1377 logging.basicConfig( |
1392 level=logging.DEBUG, | 1378 level=logging.DEBUG, |
1393 format='%(asctime).19s %(levelname)s %(filename)s:' | 1379 format='%(asctime).19s %(levelname)s %(filename)s:' |
1394 '%(lineno)s %(message)s') | 1380 '%(lineno)s %(message)s') |
1395 unittest.main() | 1381 unittest.main() |
1396 | 1382 |
1397 # vim: ts=2:sw=2:tw=80:et: | 1383 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |