Commit baa578e3 authored by maruel@chromium.org's avatar maruel@chromium.org

Add testing for a solution entry where url = None.

This is being abused by WebKit.

TEST=new smoke test

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@52096 0039d316-1c4b-4281-b951-d872f2087c98
parent 9b13351c
......@@ -720,9 +720,11 @@ solutions = [
# Inner helper to generate base url and rev tuple
def GetURLAndRev(name, original_url):
if not original_url:
return None
url, _ = gclient_utils.SplitUrlRevision(original_url)
scm = gclient_scm.CreateSCM(original_url, self.root_dir(), name)
return (url, scm.revinfo(self._options, [], None))
return '%s@%s' % (url, scm.revinfo(self._options, [], None))
# text of the snapshot gclient file
new_gclient = ""
......@@ -735,9 +737,9 @@ solutions = [
name = solution.name
if name in solution_names:
raise gclient_utils.Error("solution %s specified more than once" % name)
(url, rev) = GetURLAndRev(name, solution.url)
entries[name] = "%s@%s" % (url, rev)
solution_names[name] = "%s@%s" % (url, rev)
url = GetURLAndRev(name, solution.url)
entries[name] = url
solution_names[name] = url
# Process the dependencies next (sort alphanumerically to ensure that
# containing directories get populated first and for readability)
......@@ -748,11 +750,9 @@ solutions = [
# First pass for direct dependencies.
for d in deps_to_process:
if type(deps[d]) == str:
(url, rev) = GetURLAndRev(d, deps[d])
entries[d] = "%s@%s" % (url, rev)
entries[d] = GetURLAndRev(d, deps[d])
elif isinstance(deps[d], self.FileImpl):
(url, rev) = GetURLAndRev(d, deps[d].file_location)
entries[d] = "%s@%s" % (url, rev)
entries[d] = GetURLAndRev(d, deps[d].file_location)
# Second pass for inherited deps (via the From keyword)
for d in deps_to_process:
......@@ -765,8 +765,11 @@ solutions = [
sub_deps = Dependency(self, deps[d].module_name, sub_deps_base_url
).ParseDepsFile(False)
url = deps[d].GetUrl(d, sub_deps_base_url, self.root_dir(), sub_deps)
(url, rev) = GetURLAndRev(d, url)
entries[d] = "%s@%s" % (url, rev)
entries[d] = GetURLAndRev(d, url)
# Build the snapshot configuration string
if self._options.snapshot:
url = entries.pop(name)
# Build the snapshot configuration string
if self._options.snapshot:
......
......@@ -194,6 +194,26 @@ class GClientSmoke(GClientSmokeBase):
self.check(('', err, 2), results)
self.assertFalse(os.path.exists(join(self.root_dir, '.gclient')))
def testSolutionNone(self):
results = self.gclient(['config', '--spec',
'solutions=[{"name": "./", "url": None}]'])
self.check(('', '', 0), results)
results = self.gclient(['sync'])
self.check(('', '', 0), results)
self.assertTree({})
results = self.gclient(['revinfo'])
self.check(('./: None\n', '', 0), results)
self.check(('', '', 0), self.gclient(['cleanup']))
self.check(('', '', 0), self.gclient(['diff']))
self.check(('', '', 0), self.gclient(['export', 'foo']))
self.assertTree({})
self.check(('', '', 0), self.gclient(['pack']))
self.check(('', '', 0), self.gclient(['revert']))
self.assertTree({})
self.check(('', '', 0), self.gclient(['runhooks']))
self.assertTree({})
self.check(('', '', 0), self.gclient(['status']))
class GClientSmokeSVN(GClientSmokeBase):
def setUp(self):
......
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