Commit 5ca2769d authored by maruel@chromium.org's avatar maruel@chromium.org

Reapply 48271 for the third time with fix.

"""
Enable automatic command and one-liner doc. Reformat pydoc accordingly.
Add parser as an argument and parse_args hook in preparation to move parse_args at the right place, inside the CMDxx functions.

R.I.P. gclient_test.py
"""
original code review at: http://codereview.chromium.org/2253002

In addition:
- Add more smoke tests: vars, hooks, runhooks
- Bugs filed about misbehavior with git checkout
- Fixed gclient runhooks

TEST=smoke test
BUG=23328

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@48309 0039d316-1c4b-4281-b951-d872f2087c98
parent 8f041185
......@@ -10,7 +10,6 @@ details on the presubmit API built into gcl.
UNIT_TESTS = [
'tests.gcl_unittest',
'tests.gclient_test',
'tests.gclient_scm_test',
'tests.gclient_utils_test',
'tests.presubmit_unittest',
......
This diff is collapsed.
......@@ -205,14 +205,19 @@ class FakeRepos(object):
# - versioned and unversioned reference
# - relative and full reference
# - deps_os
# TODO(maruel):
# - var
# - hooks
# TODO(maruel):
# - File
# - $matching_files
# - use_relative_paths
self._commit_svn(file_system(1, """
vars = {
'DummyVariable': 'third_party',
}
deps = {
'src/other': 'svn://%(host)s/svn/trunk/other',
'src/third_party/fpp': '/trunk/third_party/foo',
'src/third_party/fpp': '/trunk/' + Var('DummyVariable') + '/foo',
}
deps_os = {
'mac': {
......@@ -225,6 +230,21 @@ deps = {
'src/other': 'svn://%(host)s/svn/trunk/other',
'src/third_party/foo': '/trunk/third_party/foo@1',
}
# 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.
hooks = [
{
'pattern': '.',
'action': ['python', '-c',
'open(\\'src/hooked1\\', \\'w\\').write(\\'hooked1\\')'],
},
{
# Should not be run.
'pattern': 'nonexistent',
'action': ['python', '-c',
'open(\\'src/hooked2\\', \\'w\\').write(\\'hooked2\\')'],
},
]
""" % { 'host': '127.0.0.1' }))
def setUpGIT(self):
......@@ -241,15 +261,20 @@ deps = {
# - versioned and unversioned reference
# - relative and full reference
# - deps_os
# TODO(maruel):
# - var
# - hooks
# TODO(maruel):
# - File
# - $matching_files
# - use_relative_paths
self._commit_git('repo_1', {
'DEPS': """
vars = {
'DummyVariable': 'repo',
}
deps = {
'src/repo2': 'git://%(host)s/git/repo_2',
'src/repo2/repo3': '/repo_3',
'src/repo2/repo3': '/' + Var('DummyVariable') + '_3',
}
deps_os = {
'mac': {
......@@ -289,7 +314,24 @@ deps = {
'src/repo2': 'git://%(host)s/git/repo_2@%(hash)s',
'src/repo2/repo_renamed': '/repo_3',
}
""" % { 'host': '127.0.0.1', 'hash': self.git_hashes['repo_2'][0][0] },
# 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.
hooks = [
{
'pattern': '.',
'action': ['python', '-c',
'open(\\'src/hooked1\\', \\'w\\').write(\\'hooked1\\')'],
},
{
# Should not be run.
'pattern': 'nonexistent',
'action': ['python', '-c',
'open(\\'src/hooked2\\', \\'w\\').write(\\'hooked2\\')'],
},
]
""" % {
# TODO(maruel): http://crosbug.com/3591 We need to strip the hash.. duh.
'host': '127.0.0.1', 'hash': self.git_hashes['repo_2'][0][0][:7] },
'origin': "git/repo_1@2\n"
})
......
This diff is collapsed.
This diff is collapsed.
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