Make gclient_scm.py use cache_dir
Instead of having custom logic for dealing with cache directories, use
git_cache.py to populate caches.
Also fixes a bug in git_cache.py where it was looking for lockfiles in cwd rather than the cache dir.
Other changes:
* _Run now returns output.
* Always print to stdout in CheckCallAndFilterOutput, even if it gets a carriage return. This is done because git progress report are carriage returns and not newlines and we don't want everything on the same line and not strip out the CRs.
* Removed members changed tests, its not very useful to know a new import is added.
BUG=339171
Review URL: https://codereview.chromium.org/180243006
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@254248 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient_utils.py b/gclient_utils.py
index 47ea502..1801a6b 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -5,6 +5,7 @@
"""Generic utils."""
import codecs
+import cStringIO
import logging
import os
import pipes
@@ -428,6 +429,7 @@
"""
assert print_stdout or filter_fn
stdout = stdout or sys.stdout
+ output = cStringIO.StringIO()
filter_fn = filter_fn or (lambda x: None)
sleep_interval = RETRY_INITIAL_SLEEP
@@ -453,9 +455,10 @@
filter_fn(None)
in_line = ''
while in_byte:
+ output.write(in_byte)
+ if print_stdout:
+ stdout.write(in_byte)
if in_byte != '\r':
- if print_stdout:
- stdout.write(in_byte)
if in_byte != '\n':
in_line += in_byte
else:
@@ -480,7 +483,7 @@
raise
if rv == 0:
- return 0
+ return output.getvalue()
if not retry:
break
print ("WARNING: subprocess '%s' in %s failed; will retry after a short "