Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Unified Diff: tests/git_common_test.py

Issue 2052113002: Make git-freeze bail out if the user has too much untracked data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Final comment Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « man/src/git-freeze.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/git_common_test.py
diff --git a/tests/git_common_test.py b/tests/git_common_test.py
index 66211796fe9cf1e4c1ec6d433859c37c27a40dd6..c44524dd716b586a728d6dffa9f200977547e631 100755
--- a/tests/git_common_test.py
+++ b/tests/git_common_test.py
@@ -731,6 +731,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)
+ }
+ 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
@@ -809,6 +826,52 @@ 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 testTooBigMultipleFiles(self):
+ def inner():
+ self.repo.git('config', 'depot-tools.freeze-size-limit', '1')
+ for i in xrange(3):
+ with open('file%d' % i, 'w') as f:
+ chunk = 'NERDFACE' * 1024
+ for _ in xrange(50): # About 400k
+ 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)
+
class GitMakeWorkdir(git_test_utils.GitRepoReadOnlyTestBase, GitCommonTestBase):
def setUp(self):
« no previous file with comments | « man/src/git-freeze.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698