Commit 21913086 authored by John Budorick's avatar John Budorick Committed by Commit Bot

Revert "gclient: Get rid of parsed_url."

Suspected of breaking the world.

This reverts commit e877b177.

TBR=ehmaldonado@chromium.org,tandrii@chromium.org
Bug: 841936
Change-Id: Iad2b55a2235d8d0b1a3d7681cbd577f795cb89dd
Reviewed-on: https://chromium-review.googlesource.com/1054440Reviewed-by: 's avatarJohn Budorick <jbudorick@chromium.org>
Commit-Queue: John Budorick <jbudorick@chromium.org>
parent 31a8da26
This diff is collapsed.
......@@ -824,6 +824,12 @@ class GitWrapper(SCMWrapper):
return sha1
def FullUrlForRelativeUrl(self, url):
# Strip from last '/'
# Equivalent to unix basename
base_url = self.url
return base_url[:base_url.rfind('/')] + url
def GetGitBackupDirPath(self):
"""Returns the path where the .git folder for the current project can be
staged/restored. Use case: subproject moved from DEPS <-> outer project."""
......
......@@ -5,6 +5,8 @@ Once upon a time, a budding web browser dev team needed a CI system.
All they had was one poor machine under a desk, and its name was Batty,
the Build and Test Yeti.
One day, an engineer named
😒😒
The End
......@@ -843,7 +843,6 @@ class FakeReposTestBase(trial_dir.TestCase):
def checkString(self, expected, result, msg=None):
"""Prints the diffs to ease debugging."""
self.assertEquals(expected.splitlines(), result.splitlines(), msg)
if expected != result:
# Strip the begining
while expected and result and expected[0] == result[0]:
......
......@@ -205,12 +205,12 @@ class GClientSmoke(GClientSmokeBase):
']\n'
'cache_dir = None\n') % self.git_base)
test(['config', 'https://example.com/foo', 'faa'],
test(['config', 'foo', 'faa'],
'solutions = [\n'
' { "name" : "foo",\n'
' "url" : "https://example.com/foo",\n'
' "url" : "foo",\n'
' "deps_file" : "DEPS",\n'
' "managed" : True,\n'
' "managed" : True,\n'
' "custom_deps" : {\n'
' },\n'
' "custom_vars": {},\n'
......@@ -218,10 +218,10 @@ class GClientSmoke(GClientSmokeBase):
']\n'
'cache_dir = None\n')
test(['config', 'https://example.com/foo', '--deps', 'blah'],
test(['config', 'foo', '--deps', 'blah'],
'solutions = [\n'
' { "name" : "foo",\n'
' "url" : "https://example.com/foo",\n'
' "url" : "foo",\n'
' "deps_file" : "blah",\n'
' "managed" : True,\n'
' "custom_deps" : {\n'
......@@ -384,7 +384,7 @@ class GClientSmokeGIT(GClientSmokeBase):
},
'src/repo2/repo_renamed/': {
'scm': 'git',
'url': self.git_base + 'repo_3',
'url': '/repo_3',
'revision': self.githash('repo_3', 2),
},
},
......@@ -1316,14 +1316,14 @@ class GClientSmokeGIT(GClientSmokeBase):
self.assertEqual([
{'url': 'git://127.0.0.1:20000/git/repo_11', 'deps_file': 'DEPS',
'hierarchy': [['src', 'git://127.0.0.1:20000/git/repo_10'],
['src/repo11', 'git://127.0.0.1:20000/git/repo_11']]},
['src/repo11', '/repo_11']]},
{'url': 'git://127.0.0.1:20000/git/repo_8', 'deps_file': 'DEPS',
'hierarchy': [['src', 'git://127.0.0.1:20000/git/repo_10'],
['src/repo9', 'git://127.0.0.1:20000/git/repo_9'],
['src/repo8', 'git://127.0.0.1:20000/git/repo_8']]},
['src/repo9', '/repo_9'],
['src/repo8', '/repo_8']]},
{'url': 'git://127.0.0.1:20000/git/repo_9', 'deps_file': 'DEPS',
'hierarchy': [['src', 'git://127.0.0.1:20000/git/repo_10'],
['src/repo9', 'git://127.0.0.1:20000/git/repo_9']]},
['src/repo9', '/repo_9']]},
], deps_files_contents)
def testFlattenCipd(self):
......
......@@ -43,6 +43,9 @@ class SCMMock(object):
self.unit_test.assertEquals('None', command)
self.unit_test.processed.put((self.name, self.url))
def FullUrlForRelativeUrl(self, url):
return self.url + url
# pylint: disable=no-self-use
def DoesRemoteURLMatch(self, _):
return True
......@@ -140,11 +143,11 @@ class GclientTest(trial_dir.TestCase):
self.assertEquals(first_3, actual[0:3])
self.assertEquals(
[
('foo/dir1', 'svn://example.com/dir1'),
('foo/dir1/dir2', 'svn://example.com/dir1/dir2'),
('foo/dir1/dir2/dir3', 'svn://example.com/dir1/dir2/dir3'),
('foo/dir1', 'svn://example.com/foo/dir1'),
('foo/dir1/dir2', 'svn://example.com/bar/dir1/dir2'),
('foo/dir1/dir2/dir3', 'svn://example.com/foo/dir1/dir2/dir3'),
('foo/dir1/dir2/dir3/dir4',
'svn://example.com/dir1/dir2/dir3/dir4'),
'svn://example.com/foo/dir1/dir2/dir3/dir4'),
],
actual[3:])
......@@ -211,27 +214,25 @@ class GclientTest(trial_dir.TestCase):
obj.add_dependencies_and_close(
[
gclient.Dependency(
obj, 'foo', 'svn://example.com/foo', 'svn://example.com/foo', None,
None, None, None, 'DEPS', True, False, None, True),
obj, 'foo', 'raw_url', 'url', None, None, None, None, 'DEPS', True,
False, None, True),
gclient.Dependency(
obj, 'bar', 'svn://example.com/bar', 'svn://example.com/bar', None,
None, None, None, 'DEPS', True, False, None, True),
obj, 'bar', 'raw_url', 'url', None, None, None, None, 'DEPS', True,
False, None, True),
],
[])
obj.dependencies[0].add_dependencies_and_close(
[
gclient.Dependency(
obj.dependencies[0], 'foo/dir1', 'svn://example.com/foo/dir1',
'svn://example.com/foo/dir1', None, None, None, None, 'DEPS', True,
False, None, True),
obj.dependencies[0], 'foo/dir1', 'raw_url', 'url', None, None, None,
None, 'DEPS', True, False, None, True),
],
[])
# TODO(ehmaldonado): Improve this test.
# Make sure __str__() works fine.
# pylint: disable=protected-access
obj.dependencies[0]._file_list.append('foo')
str_obj = str(obj)
self.assertEquals(322, len(str_obj), '%d\n%s' % (len(str_obj), str_obj))
self.assertEquals(263, len(str_obj), '%d\n%s' % (len(str_obj), str_obj))
def testHooks(self):
topdir = self.root_dir
......@@ -459,10 +460,10 @@ class GclientTest(trial_dir.TestCase):
self.assertEquals(
[
('bar', 'svn://example.com/bar'),
('bar/unix', 'svn://example.com/unix'),
('bar/unix', 'svn://example.com/bar/unix'),
('foo', 'svn://example.com/foo'),
('foo/baz', 'svn://example.com/baz'),
('foo/unix', 'svn://example.com/unix'),
('foo/baz', 'svn://example.com/foo/baz'),
('foo/unix', 'svn://example.com/foo/unix'),
],
sorted(self._get_processed()))
......@@ -619,12 +620,13 @@ class GclientTest(trial_dir.TestCase):
with self.assertRaises(gclient_utils.Error):
gclient.Dependency.MergeWithOsDeps(deps, deps_os, target_os_list, False)
def testOverride(self):
"""Verifies expected behavior of OverrideURL."""
def testLateOverride(self):
"""Verifies expected behavior of LateOverride."""
url = "git@github.com:dart-lang/spark.git"
d = gclient.Dependency(None, 'name', url, url,
d = gclient.Dependency(None, 'name', 'raw_url', 'url',
None, None, None, None, '', True, False, None, True)
self.assertEquals(url, d.url)
late_url = d.LateOverride(url)
self.assertEquals(url, late_url)
def testDepsOsOverrideDepsInDepsFile(self):
"""Verifies that a 'deps_os' path cannot override a 'deps' path. Also
......@@ -710,9 +712,9 @@ class GclientTest(trial_dir.TestCase):
[
('foo', 'svn://example.com/foo'),
('foo/bar', 'svn://example.com/bar'),
('bar', 'svn://example.com/bar'),
('baz', 'svn://example.com/baz'),
('fizz', 'svn://example.com/fizz'),
('bar', 'svn://example.com/foo/bar'),
('baz', 'svn://example.com/foo/bar/baz'),
('fizz', 'svn://example.com/foo/bar/baz/fizz'),
],
self._get_processed())
......@@ -767,9 +769,9 @@ class GclientTest(trial_dir.TestCase):
obj.RunOnDeps('None', [])
self.assertEquals(
[
('bar', 'svn://example.com/bar'),
('baz', 'svn://example.com/baz'),
('fizz', 'svn://example.com/fizz'),
('bar', 'svn://example.com/foo/bar'),
('baz', 'svn://example.com/foo/bar/baz'),
('fizz', 'svn://example.com/foo/bar/baz/fizz'),
('foo', 'svn://example.com/foo'),
('foo/bar', 'svn://example.com/bar'),
('foo/tar', 'svn://example.com/tar'),
......@@ -808,8 +810,8 @@ class GclientTest(trial_dir.TestCase):
self.assertEquals(
[
('foo', 'svn://example.com/foo'),
('foo/bar', 'svn://example.com/bar'),
('foo/baz', 'svn://example.com/baz'),
('foo/bar', 'svn://example.com/foo/bar'),
('foo/baz', 'svn://example.com/foo/bar/baz'),
],
self._get_processed())
......@@ -845,8 +847,8 @@ class GclientTest(trial_dir.TestCase):
self.assertEquals(
[
('foo', 'svn://example.com/foo'),
('foo/bar', 'svn://example.com/bar'),
('foo/bar/baz', 'svn://example.com/baz'),
('foo/bar', 'svn://example.com/foo/bar'),
('foo/bar/baz', 'svn://example.com/foo/bar/baz'),
],
self._get_processed())
......@@ -928,11 +930,11 @@ class GclientTest(trial_dir.TestCase):
[
('foo', 'svn://example.com/foo'),
('foo/bar', 'svn://example.com/bar'),
('bar', 'svn://example.com/bar'),
('bar', 'svn://example.com/foo/bar'),
# Deps after this would have been skipped if we were obeying
# |recursedeps|.
('baz', 'svn://example.com/baz'),
('fizz', 'svn://example.com/fizz'),
('baz', 'svn://example.com/foo/bar/baz'),
('fizz', 'svn://example.com/foo/bar/baz/fizz'),
# And this dep would have been picked up if we were obeying
# |recursedeps|.
# 'svn://example.com/foo/bar/baz/fuzz',
......@@ -970,8 +972,8 @@ class GclientTest(trial_dir.TestCase):
self.assertEquals(
[
('foo', 'svn://example.com/foo'),
('bar', 'svn://example.com/bar'),
('baz', 'svn://example.com/baz'),
('bar', 'svn://example.com/foo/bar'),
('baz', 'svn://example.com/foo/bar/baz'),
],
self._get_processed())
......@@ -1006,7 +1008,7 @@ class GclientTest(trial_dir.TestCase):
self.assertEquals(
[
('foo', 'svn://example.com/foo'),
('bar', 'svn://example.com/bar'),
('bar', 'svn://example.com/foo/bar'),
],
self._get_processed())
......@@ -1031,7 +1033,7 @@ class GclientTest(trial_dir.TestCase):
self.assertEquals(
[
('foo', 'svn://example.com/foo'),
('bar', 'svn://example.com/bar'),
('bar', 'svn://example.com/foo/bar'),
],
self._get_processed())
......@@ -1203,9 +1205,8 @@ class GclientTest(trial_dir.TestCase):
obj.add_dependencies_and_close(
[
gclient.Dependency(
obj, 'foo', 'svn://example.com/foo', 'svn://example.com/foo', None,
None, None, None, 'DEPS', True,
False, None, True),
obj, 'foo', 'raw_url', 'url', None, None, None, None, 'DEPS', True,
False, None, True),
],
[])
obj.dependencies[0].add_dependencies_and_close(
......@@ -1245,8 +1246,8 @@ class GclientTest(trial_dir.TestCase):
foo_sol = obj.dependencies[0]
self.assertEqual(
'https://example.com/foo.git',
foo_sol.FuzzyMatchUrl(['https://example.com/foo.git', 'foo'])
)
foo_sol.FuzzyMatchUrl('https://example.com/foo.git',
['https://example.com/foo.git', 'foo']))
def testFuzzyMatchUrlByURLNoGit(self):
write(
......@@ -1266,8 +1267,8 @@ class GclientTest(trial_dir.TestCase):
foo_sol = obj.dependencies[0]
self.assertEqual(
'https://example.com/foo',
foo_sol.FuzzyMatchUrl(['https://example.com/foo', 'foo'])
)
foo_sol.FuzzyMatchUrl('https://example.com/foo.git',
['https://example.com/foo', 'foo']))
def testFuzzyMatchUrlByName(self):
write(
......@@ -1285,7 +1286,9 @@ class GclientTest(trial_dir.TestCase):
options, _ = gclient.OptionParser().parse_args([])
obj = gclient.GClient.LoadCurrentConfig(options)
foo_sol = obj.dependencies[0]
self.assertEqual('foo', foo_sol.FuzzyMatchUrl(['foo']))
self.assertEqual(
'foo',
foo_sol.FuzzyMatchUrl('https://example.com/foo.git', ['foo']))
if __name__ == '__main__':
......
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