| 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 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 def assertTree(self, tree, tree_root=None): | 910 def assertTree(self, tree, tree_root=None): |
| 911 """Diff the checkout tree with a dict.""" | 911 """Diff the checkout tree with a dict.""" |
| 912 if not tree_root: | 912 if not tree_root: |
| 913 tree_root = self.root_dir | 913 tree_root = self.root_dir |
| 914 actual = read_tree(tree_root) | 914 actual = read_tree(tree_root) |
| 915 diff = dict_diff(tree, actual) | 915 diff = dict_diff(tree, actual) |
| 916 if diff: | 916 if diff: |
| 917 logging.debug('Actual %s\n%s' % (tree_root, pprint.pformat(actual))) | 917 logging.debug('Actual %s\n%s' % (tree_root, pprint.pformat(actual))) |
| 918 logging.debug('Expected\n%s' % pprint.pformat(tree)) | 918 logging.debug('Expected\n%s' % pprint.pformat(tree)) |
| 919 logging.debug('Diff\n%s' % pprint.pformat(diff)) | 919 logging.debug('Diff\n%s' % pprint.pformat(diff)) |
| 920 self.assertEquals(diff, []) | 920 self.assertEquals(diff, {}) |
| 921 | 921 |
| 922 def mangle_svn_tree(self, *args): | 922 def mangle_svn_tree(self, *args): |
| 923 """Creates a 'virtual directory snapshot' to compare with the actual result | 923 """Creates a 'virtual directory snapshot' to compare with the actual result |
| 924 on disk.""" | 924 on disk.""" |
| 925 result = {} | 925 result = {} |
| 926 for item, new_root in args: | 926 for item, new_root in args: |
| 927 old_root, rev = item.split('@', 1) | 927 old_root, rev = item.split('@', 1) |
| 928 tree = self.FAKE_REPOS.svn_revs[int(rev)] | 928 tree = self.FAKE_REPOS.svn_revs[int(rev)] |
| 929 for k, v in tree.iteritems(): | 929 for k, v in tree.iteritems(): |
| 930 if not k.startswith(old_root): | 930 if not k.startswith(old_root): |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 fake.set_up_git() | 963 fake.set_up_git() |
| 964 print('Fake setup, press enter to quit or Ctrl-C to keep the checkouts.') | 964 print('Fake setup, press enter to quit or Ctrl-C to keep the checkouts.') |
| 965 sys.stdin.readline() | 965 sys.stdin.readline() |
| 966 except KeyboardInterrupt: | 966 except KeyboardInterrupt: |
| 967 trial_dir.TrialDir.SHOULD_LEAK.leak = True | 967 trial_dir.TrialDir.SHOULD_LEAK.leak = True |
| 968 return 0 | 968 return 0 |
| 969 | 969 |
| 970 | 970 |
| 971 if __name__ == '__main__': | 971 if __name__ == '__main__': |
| 972 sys.exit(main(sys.argv)) | 972 sys.exit(main(sys.argv)) |
| OLD | NEW |