Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: testing_support/fake_repos.py

Issue 25322002: Add support in gclient for pre-DEPS hooks (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Add --noprehooks flag Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« gclient.py ('K') | « gclient.py ('k') | tests/gclient_smoketest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing_support/fake_repos.py
diff --git a/testing_support/fake_repos.py b/testing_support/fake_repos.py
index 43a4735fb6b858756ca3ef7929f10d1e067ffcbc..8a5cf6be0736289896f79efe8c81f8d56ac636c1 100755
--- a/testing_support/fake_repos.py
+++ b/testing_support/fake_repos.py
@@ -439,7 +439,7 @@ class FakeReposBase(object):
class FakeRepos(FakeReposBase):
"""Implements populateSvn() and populateGit()."""
- NB_GIT_REPOS = 4
+ NB_GIT_REPOS = 5
def populateSvn(self):
"""Creates a few revisions of changes including DEPS files."""
@@ -559,7 +559,7 @@ hooks = [
def populateGit(self):
# Testing:
- # - dependency disapear
+ # - dependency disappear
# - dependency renamed
# - versioned and unversioned reference
# - relative and full reference
@@ -657,6 +657,55 @@ hooks = [
'origin': 'git/repo_1@2\n',
})
+ self._commit_git('repo_5', {'origin': 'git/repo_5@1\n'})
+ self._commit_git('repo_5', {
+ 'DEPS': """
+deps = {
+ 'src/repo1': '%(git_base)srepo_1@%(hash1)s',
+ 'src/repo2': '%(git_base)srepo_2@%(hash2)s',
+}
+
+# Hooks to run after a project is processed but before its dependencies are
+# processed.
+pre_deps_hooks = [
+ {
+ 'action': ['python', '-c',
+ 'print "pre-deps hook"; open(\\'src/git_pre_deps_hooked\\', \\'w\\').write(\\'git_pre_deps_hooked\\')'],
+ }
+]
+""" % {
+ 'git_base': self.git_base,
+ 'hash1': self.git_hashes['repo_1'][2][0][:7],
+ 'hash2': self.git_hashes['repo_2'][1][0][:7],
+ },
+ 'origin': 'git/repo_5@2\n',
+ })
+ self._commit_git('repo_5', {
+ 'DEPS': """
+deps = {
+ 'src/repo1': '%(git_base)srepo_1@%(hash1)s',
+ 'src/repo2': '%(git_base)srepo_2@%(hash2)s',
+}
+
+# Hooks to run after a project is processed but before its dependencies are
+# processed.
+pre_deps_hooks = [
+ {
+ 'action': ['python', '-c',
+ 'print "pre-deps hook"; open(\\'src/git_pre_deps_hooked\\', \\'w\\').write(\\'git_pre_deps_hooked\\')'],
+ },
+ {
+ 'action': ['python', '-c', 'import sys; sys.exit(1)'],
+ }
+]
+""" % {
+ 'git_base': self.git_base,
+ 'hash1': self.git_hashes['repo_1'][2][0][:7],
+ 'hash2': self.git_hashes['repo_2'][1][0][:7],
+ },
+ 'origin': 'git/repo_5@3\n',
+ })
+
class FakeRepoTransitive(FakeReposBase):
"""Implements populateSvn()"""
« gclient.py ('K') | « gclient.py ('k') | tests/gclient_smoketest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698