Revert of Run `svn cleanup` before every update and reset. (https://chromiumcodereview.appspot.com/240503007/)

Reason for revert:
It's inconclusive if this actually helped the bots, so reverting.

Original issue's description:
> Run `svn cleanup` before every update and reset.
> 
> Testing on a bot with an 'unclean' Chromium checkout:
> 
> Unpatched `gclient revert -v -v -v --nohooks --upstream` (unclean checkout)
> real    9m14.280s
> user    0m37.238s
> sys     0m37.738s
> 
> Patched 'gclient revert -v -v -v --nohooks --upstream'  (unclean checkout)
> real    5m50.065s
> user    1m18.889s
> sys     0m57.860s
> 
> ---------------- after patched gclient revert run (cleans the checkout)
> 
> Unpatched 'gclient revert -v -v -v --nohooks --upstream' (clean checkout)
> real    0m21.602s
> user    0m24.966s
> sys     0m13.969s
> 
> Patched 'gclient revert -v -v -v --nohooks --upstream' (clean checkout)
> real    0m27.467s
> user    0m28.382s
> sys     0m22.629s
> 
> BUG=336983
> 
> Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=264753

[email protected],[email protected]
NOTREECHECKS=true
NOTRY=true
BUG=336983

Review URL: https://codereview.chromium.org/245293003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@265093 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient_scm.py b/gclient_scm.py
index c0b4a32..a1c26c9 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -1196,13 +1196,18 @@
            'Try using @unmanaged.\n%s') % (
             self.checkout_path, from_info))
 
-    try:
-      self._Run(['cleanup', self.checkout_path], options)
-    except subprocess2.CalledProcessError, e:
-      # Look for locked directories.
-      dir_info = scm.SVN.CaptureStatus(
-          None, os.path.join(self.checkout_path, '.'))
-      if any(d[0][2] == 'L' for d in dir_info):
+    # Look for locked directories.
+    dir_info = scm.SVN.CaptureStatus(
+        None, os.path.join(self.checkout_path, '.'))
+    if any(d[0][2] == 'L' for d in dir_info):
+      try:
+        self._Run(['cleanup', self.checkout_path], options)
+      except subprocess2.CalledProcessError, e:
+        # Get the status again, svn cleanup may have cleaned up at least
+        # something.
+        dir_info = scm.SVN.CaptureStatus(
+            None, os.path.join(self.checkout_path, '.'))
+
         # Try to fix the failures by removing troublesome files.
         for d in dir_info:
           if d[0][2] == 'L':
@@ -1355,8 +1360,6 @@
       # Don't reuse the args.
       return self.update(options, [], file_list)
 
-    self._Run(['cleanup', self.checkout_path], options)
-
     def printcb(file_status):
       if file_list is not None:
         file_list.append(file_status[1])