gclient: Don't parse DEPS files that we won't recurse into.

Bug: 830306
Change-Id: I419f16583dc2bf4bd2a66a41eb73fff4802686a8
Reviewed-on: https://chromium-review.googlesource.com/1011391
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
diff --git a/gclient.py b/gclient.py
index 437190a..88319b6 100755
--- a/gclient.py
+++ b/gclient.py
@@ -1014,13 +1014,14 @@
         while file_list[i].startswith(('\\', '/')):
           file_list[i] = file_list[i][1:]
 
-    # Always parse the DEPS file.
-    self.ParseDepsFile(expand_vars=(command != 'flatten'))
+    if self.recursion_limit:
+      self.ParseDepsFile(expand_vars=(command != 'flatten'))
+
     self._run_is_done(file_list or [], parsed_url)
-    if command in ('update', 'revert') and not options.noprehooks:
-      self.RunPreDepsHooks()
 
     if self.recursion_limit:
+      if command in ('update', 'revert') and not options.noprehooks:
+        self.RunPreDepsHooks()
       # Parse the dependencies of this dependency.
       for s in self.dependencies:
         if s.should_process: