Index: tests/git_common_test.py |
diff --git a/tests/git_common_test.py b/tests/git_common_test.py |
index bba5b43ff8b163a2f4b725a82e8ad02631b219ce..5190bf7e16c177e376e2e9276227e1b902aa9590 100755 |
--- a/tests/git_common_test.py |
+++ b/tests/git_common_test.py |
@@ -331,26 +331,29 @@ class GitMutableFunctionsTest(git_test_utils.GitRepoReadWriteTestBase, |
def testConfig(self): |
self.repo.git('config', '--add', 'happy.derpies', 'food') |
- self.assertEquals(self.repo.run(self.gc.config_list, 'happy.derpies'), |
+ self.assertEquals(self.repo.run(self.gc.get_config_list, 'happy.derpies'), |
['food']) |
- self.assertEquals(self.repo.run(self.gc.config_list, 'sad.derpies'), []) |
+ self.assertEquals(self.repo.run(self.gc.get_config_list, 'sad.derpies'), []) |
self.repo.git('config', '--add', 'happy.derpies', 'cat') |
- self.assertEquals(self.repo.run(self.gc.config_list, 'happy.derpies'), |
+ self.assertEquals(self.repo.run(self.gc.get_config_list, 'happy.derpies'), |
['food', 'cat']) |
- self.assertEquals('cat', self.repo.run(self.gc.config, 'dude.bob', 'cat')) |
+ self.assertEquals('cat', self.repo.run(self.gc.get_config, 'dude.bob', |
+ 'cat')) |
self.repo.run(self.gc.set_config, 'dude.bob', 'dog') |
- self.assertEquals('dog', self.repo.run(self.gc.config, 'dude.bob', 'cat')) |
+ self.assertEquals('dog', self.repo.run(self.gc.get_config, 'dude.bob', |
+ 'cat')) |
self.repo.run(self.gc.del_config, 'dude.bob') |
# This should work without raising an exception |
self.repo.run(self.gc.del_config, 'dude.bob') |
- self.assertEquals('cat', self.repo.run(self.gc.config, 'dude.bob', 'cat')) |
+ self.assertEquals('cat', self.repo.run(self.gc.get_config, 'dude.bob', |
+ 'cat')) |
self.assertEquals('origin/master', self.repo.run(self.gc.root)) |
@@ -425,10 +428,11 @@ class GitMutableStructuredTest(git_test_utils.GitRepoReadWriteTestBase, |
) |
self.assertEqual( |
- self.repo['B'], self.repo.run(self.gc.config, 'branch.branch_K.base') |
+ self.repo['B'], self.repo.run(self.gc.get_config, 'branch.branch_K.base') |
) |
self.assertEqual( |
- 'branch_G', self.repo.run(self.gc.config, 'branch.branch_K.base-upstream') |
+ 'branch_G', self.repo.run(self.gc.get_config, |
+ 'branch.branch_K.base-upstream') |
) |
# deadbeef is a bad hash, so this will result in repo['B'] |
@@ -454,8 +458,8 @@ class GitMutableStructuredTest(git_test_utils.GitRepoReadWriteTestBase, |
self.repo.run(self.gc.remove_merge_base, 'branch_K') |
self.repo.run(self.gc.remove_merge_base, 'branch_L') |
- self.assertEqual(None, |
- self.repo.run(self.gc.config, 'branch.branch_K.base')) |
+ self.assertEqual(None, self.repo.run(self.gc.get_config, |
+ 'branch.branch_K.base')) |
self.assertEqual({}, self.repo.run(self.gc.branch_config_map, 'base')) |
@@ -577,6 +581,23 @@ class GitMutableStructuredTest(git_test_utils.GitRepoReadWriteTestBase, |
CAT DOG |
""") |
+ def testStatus(self): |
+ def inner(): |
+ dictified_status = lambda: { |
+ k: dict(v._asdict()) # pylint: disable=W0212 |
+ for k, v in self.repo.run(self.gc.status).iteritems() |
+ } |
+ self.repo.git('mv', 'file', 'cat') |
+ with open('COOL', 'w') as f: |
+ f.write('Super cool file!') |
+ self.assertDictEqual( |
+ dictified_status(), |
+ {'cat': {'lstat': 'R', 'rstat': ' ', 'src': 'file'}, |
+ 'COOL': {'lstat': '?', 'rstat': '?', 'src': 'COOL'}} |
+ ) |
+ |
+ self.repo.run(inner) |
+ |
class GitFreezeThaw(git_test_utils.GitRepoReadWriteTestBase): |
@classmethod |
@@ -655,6 +676,39 @@ class GitFreezeThaw(git_test_utils.GitRepoReadWriteTestBase): |
self.repo.run(inner) |
+ def testTooBig(self): |
+ def inner(): |
+ self.repo.git('config', 'depot-tools.freeze-size-limit', '1') |
+ with open('bigfile', 'w') as f: |
+ chunk = 'NERDFACE' * 1024 |
+ for _ in xrange(128 * 2 + 1): # Just over 2 mb |
+ f.write(chunk) |
+ _, err = self.repo.capture_stdio(self.gc.freeze) |
+ self.assertIn('too much untracked+unignored', err) |
+ |
+ self.repo.run(inner) |
+ |
+ def testMerge(self): |
+ def inner(): |
+ self.repo.git('checkout', '-b', 'bad_merge_branch') |
+ with open('bad_merge', 'w') as f: |
+ f.write('bad_merge_left') |
+ self.repo.git('add', 'bad_merge') |
+ self.repo.git('commit', '-m', 'bad_merge') |
+ |
+ self.repo.git('checkout', 'branch_D') |
+ with open('bad_merge', 'w') as f: |
+ f.write('bad_merge_right') |
+ self.repo.git('add', 'bad_merge') |
+ self.repo.git('commit', '-m', 'bad_merge_d') |
+ |
+ self.repo.git('merge', 'bad_merge_branch') |
+ |
+ _, err = self.repo.capture_stdio(self.gc.freeze) |
+ self.assertIn('Cannot freeze unmerged changes', err) |
+ |
+ self.repo.run(inner) |
+ |
if __name__ == '__main__': |
sys.exit(coverage_utils.covered_main( |