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

Unified Diff: gclient.py

Issue 9232068: Added `gclient hookinfo`. This will be used to convert hooks into (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 8 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient.py
===================================================================
--- gclient.py (revision 119551)
+++ gclient.py (working copy)
@@ -1080,6 +1080,23 @@
print('%s: %s' % (x, entries[x]))
logging.info(str(self))
+ def HookInfo(self):
+ work_queue = gclient_utils.ExecutionQueue(self._options.jobs, None)
+ for s in self.dependencies:
+ work_queue.enqueue(s)
+ work_queue.flush({}, None, [], options=self._options)
+ hooks = []
+ def _f(*args, **kwargs):
+ cwd = kwargs['cwd'][len(self.root.root_dir)+1:]
+ if not cwd:
+ cwd = '.'
+ hooks.append({'command': list(*args), 'cwd': cwd})
+ tmp = gclient_utils.CheckCallAndFilterAndHeader
+ gclient_utils.CheckCallAndFilterAndHeader = _f
M-A Ruel 2012/01/28 02:15:18 :/ I'd rather have you pass an argument to RunHook
szager 2012/01/30 18:47:07 OK, less monkey more patch.
+ self.RunHooksRecursively(self._options)
+ gclient_utils.CheckCallAndFilterAndHeader = tmp
+ return hooks
+
def ParseDepsFile(self):
"""No DEPS to parse for a .gclient file."""
raise gclient_utils.Error('Internal error')
@@ -1423,6 +1440,17 @@
return 0
+def CMDhookinfo(parser, args):
+ """Output the hooks that would be run by `gclient runhooks`"""
+
+ (options, args) = parser.parse_args(args)
+ client = GClient.LoadCurrentConfig(options)
+ if not client:
+ raise gclient_utils.Error('client not configured; see \'gclient config\'')
+ print client.HookInfo()
+ return 0
+
+
def Command(name):
return getattr(sys.modules[__name__], 'CMD' + name, None)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698