Commit 271375b0 authored by maruel@chromium.org's avatar maruel@chromium.org

Move DEPS parsing into a single function. This is a move towards having each...

Move DEPS parsing into a single function. This is a move towards having each DEPS entry being a Dependency instance.

TEST=new revinfo unit tests

Review URL: http://codereview.chromium.org/2839008

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@50630 0039d316-1c4b-4281-b951-d872f2087c98
parent bbfc80f6
This diff is collapsed.
...@@ -337,8 +337,8 @@ class FakeRepos(object): ...@@ -337,8 +337,8 @@ class FakeRepos(object):
# - deps_os # - deps_os
# - var # - var
# - hooks # - hooks
# TODO(maruel):
# - From # - From
# TODO(maruel):
# - File # - File
# - $matching_files # - $matching_files
# - use_relative_paths # - use_relative_paths
...@@ -360,8 +360,8 @@ deps_os = { ...@@ -360,8 +360,8 @@ deps_os = {
fs = file_system(2, """ fs = file_system(2, """
deps = { deps = {
'src/other': 'svn://%(host)s/svn/trunk/other', 'src/other': 'svn://%(host)s/svn/trunk/other',
'src/third_party/foo': '/trunk/third_party/foo@1', #'src/third_party/foo': '/trunk/third_party/foo@1',
#'src/third_party/foo': From('src/other', 'foo/bar'), 'src/third_party/foo': From('src/other', 'foo/bar'),
} }
# I think this is wrong to have the hooks run from the base of the gclient # I think this is wrong to have the hooks run from the base of the gclient
# checkout. It's maybe a bit too late to change that behavior. # checkout. It's maybe a bit too late to change that behavior.
...@@ -405,8 +405,8 @@ deps = { ...@@ -405,8 +405,8 @@ deps = {
# - deps_os # - deps_os
# - var # - var
# - hooks # - hooks
# TODO(maruel):
# - From # - From
# TODO(maruel):
# - File # - File
# - $matching_files # - $matching_files
# - use_relative_paths # - use_relative_paths
...@@ -467,8 +467,8 @@ deps = { ...@@ -467,8 +467,8 @@ deps = {
'DEPS': """ 'DEPS': """
deps = { deps = {
'src/repo2': 'git://%(host)s/git/repo_2@%(hash)s', 'src/repo2': 'git://%(host)s/git/repo_2@%(hash)s',
'src/repo2/repo_renamed': '/repo_3', #'src/repo2/repo_renamed': '/repo_3',
#'src/repo2/repo_renamed': From('src/repo2', 'foo/bar'), 'src/repo2/repo_renamed': From('src/repo2', 'foo/bar'),
} }
# I think this is wrong to have the hooks run from the base of the gclient # I think this is wrong to have the hooks run from the base of the gclient
# checkout. It's maybe a bit too late to change that behavior. # checkout. It's maybe a bit too late to change that behavior.
......
...@@ -283,6 +283,8 @@ class GClientSmokeSVN(GClientSmokeBase): ...@@ -283,6 +283,8 @@ class GClientSmokeSVN(GClientSmokeBase):
# matching. # matching.
results = self.gclient(['revert', '--deps', 'mac']) results = self.gclient(['revert', '--deps', 'mac'])
out = self.splitBlock(results[0]) out = self.splitBlock(results[0])
# src, src/other is missing, src/other, src/third_party/foo is missing,
# src/third_party/foo, 2 svn hooks.
self.assertEquals(7, len(out)) self.assertEquals(7, len(out))
self.checkString('', results[1]) self.checkString('', results[1])
self.assertEquals(0, results[2]) self.assertEquals(0, results[2])
...@@ -375,7 +377,6 @@ class GClientSmokeSVN(GClientSmokeBase): ...@@ -375,7 +377,6 @@ class GClientSmokeSVN(GClientSmokeBase):
self.assertEquals([], out) self.assertEquals([], out)
def testRevInfo(self): def testRevInfo(self):
# TODO(maruel): Test multiple solutions.
self.gclient(['config', self.svn_base + 'trunk/src/']) self.gclient(['config', self.svn_base + 'trunk/src/'])
self.gclient(['sync', '--deps', 'mac']) self.gclient(['sync', '--deps', 'mac'])
results = self.gclient(['revinfo', '--deps', 'mac']) results = self.gclient(['revinfo', '--deps', 'mac'])
...@@ -586,6 +587,7 @@ class GClientSmokeBoth(GClientSmokeBase): ...@@ -586,6 +587,7 @@ class GClientSmokeBoth(GClientSmokeBase):
'{"name": "src-git",' '{"name": "src-git",'
'"url": "' + self.git_base + 'repo_1"}]']) '"url": "' + self.git_base + 'repo_1"}]'])
results = self.gclient(['sync', '--deps', 'mac']) results = self.gclient(['sync', '--deps', 'mac'])
# 3x svn checkout, 3x run hooks
self.checkBlock(results[0], self.checkBlock(results[0],
['running', 'running', 'running', 'running', 'running', ['running', 'running', 'running', 'running', 'running',
'running', 'running']) 'running', 'running'])
...@@ -633,6 +635,31 @@ class GClientSmokeBoth(GClientSmokeBase): ...@@ -633,6 +635,31 @@ class GClientSmokeBoth(GClientSmokeBase):
('trunk/third_party/foo@2', 'src/third_party/prout'))) ('trunk/third_party/foo@2', 'src/third_party/prout')))
self.assertTree(tree) self.assertTree(tree)
def testRevInfo(self):
if not self.enabled:
return
self.gclient(['config', '--spec',
'solutions=['
'{"name": "src",'
' "url": "' + self.svn_base + 'trunk/src/"},'
'{"name": "src-git",'
'"url": "' + self.git_base + 'repo_1"}]'])
self.gclient(['sync', '--deps', 'mac'])
results = self.gclient(['revinfo', '--deps', 'mac'])
out = ('src: %(svn_base)s/src/@2;\n'
'src-git: %(git_base)srepo_1@%(hash1)s;\n'
'src/other: %(svn_base)s/other@2;\n'
'src/repo2: %(git_base)srepo_2@%(hash2)s;\n'
'src/repo2/repo_renamed: %(git_base)srepo_3@%(hash3)s;\n'
'src/third_party/foo: %(svn_base)s/third_party/foo@1\n') % {
'svn_base': self.svn_base + 'trunk',
'git_base': self.git_base,
'hash1': self.githash('repo_1', 2),
'hash2': self.githash('repo_2', 1),
'hash3': self.githash('repo_3', 2),
}
self.check((out, '', 0), results)
if __name__ == '__main__': if __name__ == '__main__':
if '-c' in sys.argv: if '-c' in sys.argv:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment