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

Reapply gclient.py refactor for the third time.

Bring some OOP and sanity to gclient.py.

- Changed the algorithm from breadth-first to depth-first.
- Added infinite recursion support.
- Fixed From() of From() dependency.
- Fixed cross solution custom deps aliasing.
- Removed support code for old .gclient_entries format.
- Removed IsGitCheckout() in favor for a direct check for .git presence.

TEST=all test pass

The main difference with r51760 is that new smoke tests have been added since which replicates how webkit checkouts with gclient.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@53205 0039d316-1c4b-4281-b951-d872f2087c98
parent 4a3bc282
This diff is collapsed.
...@@ -310,14 +310,6 @@ def SubprocessCallAndFilter(command, ...@@ -310,14 +310,6 @@ def SubprocessCallAndFilter(command,
raise Error(msg) raise Error(msg)
def IsUsingGit(root, paths):
"""Returns True if we're using git to manage any of our checkouts.
|entries| is a list of paths to check."""
for path in paths:
if os.path.exists(os.path.join(root, path, '.git')):
return True
return False
def FindGclientRoot(from_dir, filename='.gclient'): def FindGclientRoot(from_dir, filename='.gclient'):
"""Tries to find the gclient root.""" """Tries to find the gclient root."""
path = os.path.realpath(from_dir) path = os.path.realpath(from_dir)
......
...@@ -602,7 +602,6 @@ class GClientSmokeGIT(GClientSmokeBase): ...@@ -602,7 +602,6 @@ class GClientSmokeGIT(GClientSmokeBase):
def testRevInfo(self): def testRevInfo(self):
if not self.enabled: if not self.enabled:
return return
# TODO(maruel): Test multiple solutions.
self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
self.gclient(['sync', '--deps', 'mac']) self.gclient(['sync', '--deps', 'mac'])
results = self.gclient(['revinfo', '--deps', 'mac']) results = self.gclient(['revinfo', '--deps', 'mac'])
...@@ -641,7 +640,7 @@ class GClientSmokeBoth(GClientSmokeBase): ...@@ -641,7 +640,7 @@ class GClientSmokeBoth(GClientSmokeBase):
# file when File() is used in a DEPS file. # file when File() is used in a DEPS file.
('running', self.root_dir + '/src/file/other'), ('running', self.root_dir + '/src/file/other'),
'running', 'running', 'running', 'running', 'running', 'running', 'running', 'running', 'running', 'running',
'running', 'running']) 'running'])
# TODO(maruel): Something's wrong here. git outputs to stderr 'Switched to # TODO(maruel): Something's wrong here. git outputs to stderr 'Switched to
# new branch \'hash\''. # new branch \'hash\''.
#self.checkString('', results[1]) #self.checkString('', results[1])
...@@ -658,7 +657,6 @@ class GClientSmokeBoth(GClientSmokeBase): ...@@ -658,7 +657,6 @@ class GClientSmokeBoth(GClientSmokeBase):
tree['src/git_hooked1'] = 'git_hooked1' tree['src/git_hooked1'] = 'git_hooked1'
tree['src/git_hooked2'] = 'git_hooked2' tree['src/git_hooked2'] = 'git_hooked2'
tree['src/svn_hooked1'] = 'svn_hooked1' tree['src/svn_hooked1'] = 'svn_hooked1'
tree['src/svn_hooked2'] = 'svn_hooked2'
self.assertTree(tree) self.assertTree(tree)
def testMultiSolutionsMultiRev(self): def testMultiSolutionsMultiRev(self):
......
...@@ -17,7 +17,7 @@ class GclientUtilsUnittest(SuperMoxTestBase): ...@@ -17,7 +17,7 @@ class GclientUtilsUnittest(SuperMoxTestBase):
members = [ members = [
'CheckCall', 'CheckCallError', 'Error', 'FileRead', 'FileWrite', 'CheckCall', 'CheckCallError', 'Error', 'FileRead', 'FileWrite',
'FindFileUpwards', 'FindGclientRoot', 'GetGClientRootAndEntries', 'FindFileUpwards', 'FindGclientRoot', 'GetGClientRootAndEntries',
'GetNamedNodeText', 'GetNodeNamedAttributeText', 'IsUsingGit', 'GetNamedNodeText', 'GetNodeNamedAttributeText',
'PathDifference', 'ParseXML', 'PrintableObject', 'RemoveDirectory', 'PathDifference', 'ParseXML', 'PrintableObject', 'RemoveDirectory',
'SplitUrlRevision', 'SubprocessCall', 'SubprocessCallAndFilter', 'SplitUrlRevision', 'SubprocessCall', 'SubprocessCallAndFilter',
'SyntaxErrorToError', 'SyntaxErrorToError',
......
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