| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 """Generate fake repositories for testing.""" | 6 """Generate fake repositories for testing.""" |
| 7 | 7 |
| 8 import atexit | 8 import atexit |
| 9 import datetime | 9 import datetime |
| 10 import errno | 10 import errno |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 NB_GIT_REPOS = 4 | 426 NB_GIT_REPOS = 4 |
| 427 | 427 |
| 428 def populateSvn(self): | 428 def populateSvn(self): |
| 429 """Creates a few revisions of changes including DEPS files.""" | 429 """Creates a few revisions of changes including DEPS files.""" |
| 430 # Repos | 430 # Repos |
| 431 subprocess2.check_call( | 431 subprocess2.check_call( |
| 432 ['svn', 'checkout', self.svn_base, self.svn_checkout, | 432 ['svn', 'checkout', self.svn_base, self.svn_checkout, |
| 433 '-q', '--non-interactive', '--no-auth-cache', | 433 '-q', '--non-interactive', '--no-auth-cache', |
| 434 '--username', self.USERS[0][0], '--password', self.USERS[0][1]]) | 434 '--username', self.USERS[0][0], '--password', self.USERS[0][1]]) |
| 435 assert os.path.isdir(join(self.svn_checkout, '.svn')) | 435 assert os.path.isdir(join(self.svn_checkout, '.svn')) |
| 436 def file_system(rev, DEPS): | 436 def file_system(rev, DEPS, DEPS_ALT=None): |
| 437 fs = { | 437 fs = { |
| 438 'origin': 'svn@%(rev)d\n', | 438 'origin': 'svn@%(rev)d\n', |
| 439 'trunk/origin': 'svn/trunk@%(rev)d\n', | 439 'trunk/origin': 'svn/trunk@%(rev)d\n', |
| 440 'trunk/src/origin': 'svn/trunk/src@%(rev)d\n', | 440 'trunk/src/origin': 'svn/trunk/src@%(rev)d\n', |
| 441 'trunk/src/third_party/origin': 'svn/trunk/src/third_party@%(rev)d\n', | 441 'trunk/src/third_party/origin': 'svn/trunk/src/third_party@%(rev)d\n', |
| 442 'trunk/other/origin': 'src/trunk/other@%(rev)d\n', | 442 'trunk/other/origin': 'src/trunk/other@%(rev)d\n', |
| 443 'trunk/third_party/origin': 'svn/trunk/third_party@%(rev)d\n', | 443 'trunk/third_party/origin': 'svn/trunk/third_party@%(rev)d\n', |
| 444 'trunk/third_party/foo/origin': 'svn/trunk/third_party/foo@%(rev)d\n', | 444 'trunk/third_party/foo/origin': 'svn/trunk/third_party/foo@%(rev)d\n', |
| 445 'trunk/third_party/prout/origin': 'svn/trunk/third_party/foo@%(rev)d\n', | 445 'trunk/third_party/prout/origin': 'svn/trunk/third_party/foo@%(rev)d\n', |
| 446 } | 446 } |
| 447 for k in fs.iterkeys(): | 447 for k in fs.iterkeys(): |
| 448 fs[k] = fs[k] % { 'rev': rev } | 448 fs[k] = fs[k] % { 'rev': rev } |
| 449 fs['trunk/src/DEPS'] = DEPS | 449 fs['trunk/src/DEPS'] = DEPS |
| 450 if DEPS_ALT: |
| 451 fs['trunk/src/DEPS.alt'] = DEPS_ALT |
| 450 return fs | 452 return fs |
| 451 | 453 |
| 452 # Testing: | 454 # Testing: |
| 453 # - dependency disapear | 455 # - dependency disapear |
| 454 # - dependency renamed | 456 # - dependency renamed |
| 455 # - versioned and unversioned reference | 457 # - versioned and unversioned reference |
| 456 # - relative and full reference | 458 # - relative and full reference |
| 457 # - deps_os | 459 # - deps_os |
| 458 # - var | 460 # - var |
| 459 # - hooks | 461 # - hooks |
| 460 # - From | 462 # - From |
| 461 # - File | 463 # - File |
| 462 # TODO(maruel): | 464 # TODO(maruel): |
| 463 # - $matching_files | 465 # - $matching_files |
| 464 # - use_relative_paths | 466 # - use_relative_paths |
| 465 fs = file_system(1, """ | 467 DEPS = """ |
| 466 vars = { | 468 vars = { |
| 467 'DummyVariable': 'third_party', | 469 'DummyVariable': 'third_party', |
| 468 } | 470 } |
| 469 deps = { | 471 deps = { |
| 470 'src/other': '%(svn_base)strunk/other@1', | 472 'src/other': '%(svn_base)strunk/other@1', |
| 471 'src/third_party/fpp': '/trunk/' + Var('DummyVariable') + '/foo', | 473 'src/third_party/fpp': '/trunk/' + Var('DummyVariable') + '/foo', |
| 472 } | 474 } |
| 473 deps_os = { | 475 deps_os = { |
| 474 'mac': { | 476 'mac': { |
| 475 'src/third_party/prout': '/trunk/third_party/prout', | 477 'src/third_party/prout': '/trunk/third_party/prout', |
| 476 }, | 478 }, |
| 477 }""" % { 'svn_base': self.svn_base }) | 479 }""" % { 'svn_base': self.svn_base } |
| 480 |
| 481 DEPS_ALT = """ |
| 482 deps = { |
| 483 'src/other2': '%(svn_base)strunk/other@2' |
| 484 } |
| 485 """ % { 'svn_base': self.svn_base } |
| 486 |
| 487 fs = file_system(1, DEPS, DEPS_ALT) |
| 478 self._commit_svn(fs) | 488 self._commit_svn(fs) |
| 479 | 489 |
| 480 fs = file_system(2, """ | 490 fs = file_system(2, """ |
| 481 deps = { | 491 deps = { |
| 482 'src/other': '%(svn_base)strunk/other', | 492 'src/other': '%(svn_base)strunk/other', |
| 483 # Load another DEPS and load a dependency from it. That's an example of | 493 # Load another DEPS and load a dependency from it. That's an example of |
| 484 # WebKit's chromium checkout flow. Verify it works out of order. | 494 # WebKit's chromium checkout flow. Verify it works out of order. |
| 485 'src/third_party/foo': From('src/file/other', 'foo/bar'), | 495 'src/third_party/foo': From('src/file/other', 'foo/bar'), |
| 486 'src/file/other': File('%(svn_base)strunk/other/DEPS'), | 496 'src/file/other': File('%(svn_base)strunk/other/DEPS'), |
| 487 } | 497 } |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 fake.set_up_git() | 743 fake.set_up_git() |
| 734 print('Fake setup, press enter to quit or Ctrl-C to keep the checkouts.') | 744 print('Fake setup, press enter to quit or Ctrl-C to keep the checkouts.') |
| 735 sys.stdin.readline() | 745 sys.stdin.readline() |
| 736 except KeyboardInterrupt: | 746 except KeyboardInterrupt: |
| 737 trial_dir.TrialDir.SHOULD_LEAK.leak = True | 747 trial_dir.TrialDir.SHOULD_LEAK.leak = True |
| 738 return 0 | 748 return 0 |
| 739 | 749 |
| 740 | 750 |
| 741 if __name__ == '__main__': | 751 if __name__ == '__main__': |
| 742 sys.exit(main(sys.argv)) | 752 sys.exit(main(sys.argv)) |
| OLD | NEW |