| OLD | NEW | 
|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python | 
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 logging | 9 import logging | 
| 10 import os | 10 import os | 
|  | 11 import pprint | 
| 11 import re | 12 import re | 
| 12 import shutil | 13 import shutil | 
| 13 import subprocess | 14 import subprocess | 
| 14 import sys | 15 import sys | 
| 15 import unittest | 16 import unittest | 
| 16 | 17 | 
| 17 | 18 | 
| 18 ## Utility functions | 19 ## Utility functions | 
| 19 | 20 | 
| 20 | 21 | 
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 493   def assertTree(self, tree, tree_root=None): | 494   def assertTree(self, tree, tree_root=None): | 
| 494     """Diff the checkout tree with a dict.""" | 495     """Diff the checkout tree with a dict.""" | 
| 495     if not tree_root: | 496     if not tree_root: | 
| 496       tree_root = self.root_dir | 497       tree_root = self.root_dir | 
| 497     actual = read_tree(tree_root) | 498     actual = read_tree(tree_root) | 
| 498     diff = dict_diff(tree, actual) | 499     diff = dict_diff(tree, actual) | 
| 499     if diff: | 500     if diff: | 
| 500       logging.debug('Actual %s\n%s' % (tree_root, pprint.pformat(actual))) | 501       logging.debug('Actual %s\n%s' % (tree_root, pprint.pformat(actual))) | 
| 501       logging.debug('Expected\n%s' % pprint.pformat(tree)) | 502       logging.debug('Expected\n%s' % pprint.pformat(tree)) | 
| 502       logging.debug('Diff\n%s' % pprint.pformat(diff)) | 503       logging.debug('Diff\n%s' % pprint.pformat(diff)) | 
|  | 504       self.assertEquals(diff, []) | 
| 503 | 505 | 
| 504 | 506 | 
| 505 def main(argv): | 507 def main(argv): | 
| 506   fake = FakeRepos() | 508   fake = FakeRepos() | 
| 507   print 'Using %s' % fake.trial_dir() | 509   print 'Using %s' % fake.trial_dir() | 
| 508   try: | 510   try: | 
| 509     fake.setUp() | 511     fake.setUp() | 
| 510     print('Fake setup, press enter to quit or Ctrl-C to keep the checkouts.') | 512     print('Fake setup, press enter to quit or Ctrl-C to keep the checkouts.') | 
| 511     sys.stdin.readline() | 513     sys.stdin.readline() | 
| 512   except KeyboardInterrupt: | 514   except KeyboardInterrupt: | 
| 513     fake.SHOULD_LEAK = True | 515     fake.SHOULD_LEAK = True | 
| 514   return 0 | 516   return 0 | 
| 515 | 517 | 
| 516 | 518 | 
| 517 if __name__ == '__main__': | 519 if __name__ == '__main__': | 
| 518   sys.exit(main(sys.argv)) | 520   sys.exit(main(sys.argv)) | 
| OLD | NEW | 
|---|