Commit b3b494f3 authored by maruel@chromium.org's avatar maruel@chromium.org

Don't cache the fact that codereview.settings wasn't found.

It must always be present.

BUG=none
TBR=none

Review URL: http://codereview.chromium.org/3280013

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@58060 0039d316-1c4b-4281-b951-d872f2087c98
parent 4c13cccd
...@@ -127,22 +127,22 @@ def GetCachedFile(filename, max_age=60*60*24*3, use_root=False): ...@@ -127,22 +127,22 @@ def GetCachedFile(filename, max_age=60*60*24*3, use_root=False):
return None return None
if (not os.path.exists(cached_file) or if (not os.path.exists(cached_file) or
(time.time() - os.stat(cached_file).st_mtime) > max_age): (time.time() - os.stat(cached_file).st_mtime) > max_age):
dir_info = SVN.CaptureInfo(".") dir_info = SVN.CaptureInfo('.')
repo_root = dir_info["Repository Root"] repo_root = dir_info['Repository Root']
if use_root: if use_root:
url_path = repo_root url_path = repo_root
else: else:
url_path = dir_info["URL"] url_path = dir_info['URL']
while True: while True:
# Look in the repository at the current level for the file. # Look in the repository at the current level for the file.
for _ in range(5): for _ in range(5):
content = "" content = None
try: try:
# Take advantage of the fact that svn won't output to stderr in case # Take advantage of the fact that svn won't output to stderr in case
# of success but will do in case of failure so don't mind putting # of success but will do in case of failure so don't mind putting
# stderr into content_array. # stderr into content_array.
content_array = [] content_array = []
svn_path = url_path + "/" + filename svn_path = url_path + '/' + filename
args = ['cat', svn_path] args = ['cat', svn_path]
if sys.platform != 'darwin': if sys.platform != 'darwin':
# MacOSX 10.5.2 has a bug with svn 1.4.4 that will trigger the # MacOSX 10.5.2 has a bug with svn 1.4.4 that will trigger the
...@@ -174,9 +174,11 @@ def GetCachedFile(filename, max_age=60*60*24*3, use_root=False): ...@@ -174,9 +174,11 @@ def GetCachedFile(filename, max_age=60*60*24*3, use_root=False):
break break
# Go up one level to try again. # Go up one level to try again.
url_path = os.path.dirname(url_path) url_path = os.path.dirname(url_path)
# Write a cached version even if there isn't a file, so we don't try to if content is not None or filename != CODEREVIEW_SETTINGS_FILE:
# fetch it each time. # Write a cached version even if there isn't a file, so we don't try to
gclient_utils.FileWrite(cached_file, content) # fetch it each time. codereview.settings must always be present so do
# not cache negative.
gclient_utils.FileWrite(cached_file, content or '')
else: else:
content = gclient_utils.FileRead(cached_file, 'r') content = gclient_utils.FileRead(cached_file, 'r')
# Keep the content cached in memory. # Keep the content cached in memory.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment