Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(911)

Unified Diff: gcl.py

Issue 3280013: Don't cache the fact that codereview.settings wasn't found. (Closed)
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
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: gcl.py
diff --git a/gcl.py b/gcl.py
index 0230c6222745824715add32a515dd3f9b827ab6d..dc5b25fc257adfe79125ae7d046a143207610b53 100755
--- a/gcl.py
+++ b/gcl.py
@@ -127,22 +127,22 @@ def GetCachedFile(filename, max_age=60*60*24*3, use_root=False):
return None
if (not os.path.exists(cached_file) or
(time.time() - os.stat(cached_file).st_mtime) > max_age):
- dir_info = SVN.CaptureInfo(".")
- repo_root = dir_info["Repository Root"]
+ dir_info = SVN.CaptureInfo('.')
+ repo_root = dir_info['Repository Root']
if use_root:
url_path = repo_root
else:
- url_path = dir_info["URL"]
+ url_path = dir_info['URL']
while True:
# Look in the repository at the current level for the file.
for _ in range(5):
- content = ""
+ content = None
try:
# 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
# stderr into content_array.
content_array = []
- svn_path = url_path + "/" + filename
+ svn_path = url_path + '/' + filename
args = ['cat', svn_path]
if sys.platform != 'darwin':
# 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):
break
# Go up one level to try again.
url_path = os.path.dirname(url_path)
- # Write a cached version even if there isn't a file, so we don't try to
- # fetch it each time.
- gclient_utils.FileWrite(cached_file, content)
+ if content is not None or filename != CODEREVIEW_SETTINGS_FILE:
+ # Write a cached version even if there isn't a file, so we don't try to
+ # fetch it each time. codereview.settings must always be present so do
+ # not cache negative.
+ gclient_utils.FileWrite(cached_file, content or '')
else:
content = gclient_utils.FileRead(cached_file, 'r')
# Keep the content cached in memory.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698