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