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

Unified Diff: tests/gclient_smoketest.py

Issue 165443004: Make gclient reset use GetUsableRev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 10 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
« gclient_scm.py ('K') | « gclient_scm.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 c05bbf339de4f23118bb331f71976d199f1db9a0..3ee3a4e14fc106f131af5ec9d3b60daa828bd13f 100755
--- a/tests/gclient_smoketest.py
+++ b/tests/gclient_smoketest.py
@@ -1003,7 +1003,32 @@ class GClientSmokeGIT(GClientSmokeBase):
def testRevertAndStatus(self):
if not self.enabled:
return
- self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
+
+ # Commit new change to repo to make repo_2's hash use a custom_var.
+ cur_deps = self.FAKE_REPOS.git_hashes['repo_1'][-1][1]['DEPS']
+ repo_2_hash = self.FAKE_REPOS.git_hashes['repo_2'][1][0][:7]
+ new_deps = cur_deps.replace('repo_2@%s\'' % repo_2_hash,
+ 'repo_2@\' + Var(\'r2hash\')')
+ new_deps = 'vars = {\'r2hash\': \'%s\'}\n%s' % (repo_2_hash, new_deps)
+ self.FAKE_REPOS._commit_git('repo_1', { # pylint: disable=W0212
+ 'DEPS': new_deps,
+ 'origin': 'git/repo_1@3\n',
+ })
+
+ config_template = (
+"""solutions = [{
+ "name" : "src",
+ "url" : "%(git_base)srepo_1",
+ "deps_file" : "DEPS",
+ "managed" : True,
+ "custom_vars" : %(custom_vars)s,
+}]""")
+
+ self.gclient(['config', '--spec', config_template % {
+ 'git_base': self.git_base,
+ 'custom_vars': {}
+ }])
+
# Tested in testSync.
self.gclient(['sync', '--deps', 'mac'])
write(join(self.root_dir, 'src', 'repo2', 'hi'), 'Hey!')
@@ -1028,13 +1053,35 @@ class GClientSmokeGIT(GClientSmokeBase):
expected3, expected3,
expected4, expected4])
self.assertEquals(8, len(out))
- tree = self.mangle_git_tree(('repo_1@2', 'src'),
+ tree = self.mangle_git_tree(('repo_1@3', 'src'),
('repo_2@1', 'src/repo2'),
('repo_3@2', 'src/repo2/repo_renamed'))
tree['src/git_hooked1'] = 'git_hooked1'
tree['src/git_hooked2'] = 'git_hooked2'
self.assertTree(tree)
+ # Make a new commit object in the origin repo, to force reset to fetch.
+ self.FAKE_REPOS._commit_git('repo_2', { # pylint: disable=W0212
+ 'origin': 'git/repo_2@3\n',
+ })
+
+ self.gclient(['config', '--spec', config_template % {
+ 'git_base': self.git_base,
+ 'custom_vars': {'r2hash': self.FAKE_REPOS.git_hashes['repo_2'][-1][0] }
+ }])
+ out = self.parseGclient(['revert', '--deps', 'mac', '--jobs', '1'],
+ [expected1, expected1,
+ expected2, expected2,
+ expected3, expected3,
+ expected4, expected4])
+ self.assertEquals(8, len(out))
+ tree = self.mangle_git_tree(('repo_1@3', 'src'),
+ ('repo_2@3', 'src/repo2'),
+ ('repo_3@2', 'src/repo2/repo_renamed'))
+ tree['src/git_hooked1'] = 'git_hooked1'
+ tree['src/git_hooked2'] = 'git_hooked2'
+ self.assertTree(tree)
+
results = self.gclient(['status', '--deps', 'mac', '--jobs', '1'])
out = results[0].splitlines(False)
# TODO(maruel): http://crosbug.com/3584 It should output the unversioned
« gclient_scm.py ('K') | « gclient_scm.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698