Chromium Code Reviews| 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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 }) | 588 }) |
| 589 | 589 |
| 590 self._commit_git('repo_2', { | 590 self._commit_git('repo_2', { |
| 591 'origin': 'git/repo_2@2\n', | 591 'origin': 'git/repo_2@2\n', |
| 592 }) | 592 }) |
| 593 | 593 |
| 594 self._commit_git('repo_4', { | 594 self._commit_git('repo_4', { |
| 595 'origin': 'git/repo_4@1\n', | 595 'origin': 'git/repo_4@1\n', |
| 596 }) | 596 }) |
| 597 | 597 |
| 598 self._commit_git('repo_1', { | |
|
M-A Ruel
2011/04/20 15:43:28
If you don't mind, I'd almost prefer you to do thi
Florian Loitsch
2011/04/20 18:32:01
done.
I started differently (no git), so I did it
| |
| 599 'origin': 'git/repo_1@2\n', | |
| 600 }) | |
| 601 | |
| 598 self._commit_git('repo_4', { | 602 self._commit_git('repo_4', { |
| 599 'origin': 'git/repo_4@2\n', | 603 'origin': 'git/repo_4@2\n', |
| 600 }) | 604 }) |
| 601 | 605 |
| 602 self._commit_git('repo_1', { | 606 self._commit_git('repo_1', { |
| 603 'DEPS': """ | 607 'DEPS': """ |
| 604 deps = { | 608 deps = { |
| 605 'src/repo2': '%(git_base)srepo_2@%(hash)s', | 609 'src/repo2': '%(git_base)srepo_2@%(hash)s', |
| 606 #'src/repo2/repo_renamed': '/repo_3', | 610 #'src/repo2/repo_renamed': '/repo_3', |
| 607 'src/repo2/repo_renamed': From('src/repo2', 'foo/bar'), | 611 'src/repo2/repo_renamed': From('src/repo2', 'foo/bar'), |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 621 'open(\\'src/git_hooked2\\', \\'w\\').write(\\'git_hooked2\\')'], | 625 'open(\\'src/git_hooked2\\', \\'w\\').write(\\'git_hooked2\\')'], |
| 622 }, | 626 }, |
| 623 ] | 627 ] |
| 624 """ % { | 628 """ % { |
| 625 'git_base': self.git_base, | 629 'git_base': self.git_base, |
| 626 # See self.__init__() for the format. Grab's the hash of the first | 630 # See self.__init__() for the format. Grab's the hash of the first |
| 627 # commit in repo_2. Only keep the first 7 character because of: | 631 # commit in repo_2. Only keep the first 7 character because of: |
| 628 # TODO(maruel): http://crosbug.com/3591 We need to strip the hash.. duh. | 632 # TODO(maruel): http://crosbug.com/3591 We need to strip the hash.. duh. |
| 629 'hash': self.git_hashes['repo_2'][1][0][:7] | 633 'hash': self.git_hashes['repo_2'][1][0][:7] |
| 630 }, | 634 }, |
| 631 'origin': 'git/repo_1@2\n', | 635 'origin': 'git/repo_1@3\n', |
| 632 }) | 636 }) |
| 633 | 637 |
| 634 | 638 |
| 635 class FakeReposTestBase(trial_dir.TestCase): | 639 class FakeReposTestBase(trial_dir.TestCase): |
| 636 """This is vaguely inspired by twisted.""" | 640 """This is vaguely inspired by twisted.""" |
| 637 # static FakeRepos instance. Lazy loaded. | 641 # static FakeRepos instance. Lazy loaded. |
| 638 FAKE_REPOS = None | 642 FAKE_REPOS = None |
| 639 # Override if necessary. | 643 # Override if necessary. |
| 640 FAKE_REPOS_CLASS = FakeRepos | 644 FAKE_REPOS_CLASS = FakeRepos |
| 641 | 645 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 733 fake.set_up_git() | 737 fake.set_up_git() |
| 734 print('Fake setup, press enter to quit or Ctrl-C to keep the checkouts.') | 738 print('Fake setup, press enter to quit or Ctrl-C to keep the checkouts.') |
| 735 sys.stdin.readline() | 739 sys.stdin.readline() |
| 736 except KeyboardInterrupt: | 740 except KeyboardInterrupt: |
| 737 trial_dir.TrialDir.SHOULD_LEAK.leak = True | 741 trial_dir.TrialDir.SHOULD_LEAK.leak = True |
| 738 return 0 | 742 return 0 |
| 739 | 743 |
| 740 | 744 |
| 741 if __name__ == '__main__': | 745 if __name__ == '__main__': |
| 742 sys.exit(main(sys.argv)) | 746 sys.exit(main(sys.argv)) |
| OLD | NEW |