Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(811)

Unified Diff: gclient.py

Issue 33089: Update gclient so runhooks is actually run for git users.... Base URL: http://gclient.googlecode.com/svn/trunk/gclient/
Patch Set: Created 16 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
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 68)
+++ gclient.py (working copy)
@@ -448,6 +448,14 @@
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
+
# -----------------------------------------------------------------------------
# SVN utils:
@@ -1088,7 +1096,7 @@
SubprocessCall(command, self._root_dir, self._options.stdout,
fail_status=2)
- def _RunHooks(self, command, file_list):
+ def _RunHooks(self, command, file_list, is_using_git):
"""Evaluates all hooks, running actions as needed.
"""
# Hooks only run for these command types.
@@ -1101,8 +1109,9 @@
hooks.extend(self._deps_hooks)
# If "--force" was specified, run all hooks regardless of what files have
- # changed.
- if self._options.force:
+ # changed. If the user is using git, then we don't know what files have
+ # changed so we always run all hooks.
+ if self._options.force or is_using_git:
for hook_dict in hooks:
self._RunHookAction(hook_dict)
return
@@ -1217,7 +1226,8 @@
scm.RunCommand(command, self._options, args, file_list)
self._options.revision = None
- self._RunHooks(command, file_list)
+ is_using_git = IsUsingGit(self._root_dir, entries.keys())
+ self._RunHooks(command, file_list, is_using_git)
if command == 'update':
# notify the user if there is an orphaned entry in their working copy.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b