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

Unified Diff: tests/gclient_smoketest.py

Issue 437903002: Add --no-history option to fetch and gclient for shallow clones. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Add test to gclient_smoketest.py Created 6 years, 4 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 | « tests/gclient_scm_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/gclient_smoketest.py
diff --git a/tests/gclient_smoketest.py b/tests/gclient_smoketest.py
index 3c56da8f5f15abe5f38294919937d52b46f287c0..eb2275e059782a0e28837d438f3e266f8278127a 100755
--- a/tests/gclient_smoketest.py
+++ b/tests/gclient_smoketest.py
@@ -1179,6 +1179,47 @@ class GClientSmokeGITMutates(GClientSmokeBase):
# files.
self.assertEquals(0, len(out))
+ def testSyncNoHistory(self):
+ if not self.enabled:
+ return
+ # Create an extra commit in repo_2 and point DEPS to its hash.
+ cur_deps = self.FAKE_REPOS.git_hashes['repo_1'][-1][1]['DEPS']
+ repo_2_hash_old = self.FAKE_REPOS.git_hashes['repo_2'][1][0][:7]
+ self.FAKE_REPOS._commit_git('repo_2', { # pylint: disable=W0212
+ 'last_file': 'file created in last commit',
+ })
+ repo_2_hash_new = self.FAKE_REPOS.git_hashes['repo_2'][-1][0]
+ new_deps = cur_deps.replace(repo_2_hash_old, repo_2_hash_new)
+ self.assertNotEqual(new_deps, cur_deps)
+ self.FAKE_REPOS._commit_git('repo_1', { # pylint: disable=W0212
+ 'DEPS': new_deps,
+ 'origin': 'git/repo_1@4\n',
+ })
+
+ config_template = (
+"""solutions = [{
+"name" : "src",
+"url" : "%(git_base)srepo_1",
+"deps_file" : "DEPS",
+"managed" : True,
+}]""")
+
+ self.gclient(['config', '--spec', config_template % {
+ 'git_base': self.git_base
+ }])
+
+ self.gclient(['sync', '--no-history', '--deps', 'mac'])
+ repo2_root = join(self.root_dir, 'src', 'repo2')
+
+ # Check that repo_2 is actually shallow and its log has only one entry.
+ rev_lists = subprocess2.check_output(['git', 'rev-list', 'HEAD'],
+ cwd=repo2_root)
+ self.assertEquals(repo_2_hash_new, rev_lists.strip('\r\n'))
+
+ # Check that we have actually checked out the right commit.
+ self.assertTrue(os.path.exists(join(repo2_root, 'last_file')))
+
+
class GClientSmokeBoth(GClientSmokeBase):
def setUp(self):
super(GClientSmokeBoth, self).setUp()
« no previous file with comments | « tests/gclient_scm_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698