Commit fa44e4ae authored by dpranke@google.com's avatar dpranke@google.com

Revert changes to GetCachedFile() in r30414, r30910, r31586, and go back to

the behavior before I started messing with it. It turns out it's not worth the
hassle to try and "clean this up"; we depend on the current convoluted
semantics, which is to crawl up the tree from the current dir looking for
codereview.settings files, but to only ever look for PRESUBMIT.py in the
root of the repo. Trying to unify the logic seems to be too painful.

   BUG=none
   R=maruel@chromium.org
   TEST=none

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@33648 0039d316-1c4b-4281-b951-d872f2087c98
parent 4a47fc71
...@@ -114,8 +114,6 @@ def GetCachedFile(filename, max_age=60*60*24*3, use_root=False): ...@@ -114,8 +114,6 @@ 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
os.stat(cached_file).st_mtime > max_age): os.stat(cached_file).st_mtime > max_age):
local_dir = os.path.dirname(os.path.abspath(filename))
local_base = os.path.basename(filename)
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:
...@@ -124,23 +122,9 @@ def GetCachedFile(filename, max_age=60*60*24*3, use_root=False): ...@@ -124,23 +122,9 @@ def GetCachedFile(filename, max_age=60*60*24*3, use_root=False):
url_path = dir_info["URL"] url_path = dir_info["URL"]
content = "" content = ""
while True: while True:
# First, look for a locally modified version of the file if we can. # Look in the repository at the current level for the file.
r = "" svn_path = url_path + "/" + filename
if not use_root: content, rc = RunShellWithReturnCode(["svn", "cat", svn_path])
local_path = os.path.join(local_dir, local_base)
r = SVN.CaptureStatus((local_path,))
rc = -1
if r:
status = r[0][0]
rc = 0
if not rc and status[0] in ('A','M'):
content = ReadFile(local_path)
rc = 0
else:
# Look in the repository if we didn't find something local.
svn_path = url_path + "/" + filename
content, rc = RunShellWithReturnCode(["svn", "cat", svn_path])
if not rc: if not rc:
# Exit the loop if the file was found. Override content. # Exit the loop if the file was found. Override content.
break break
...@@ -151,7 +135,6 @@ def GetCachedFile(filename, max_age=60*60*24*3, use_root=False): ...@@ -151,7 +135,6 @@ 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)
local_dir = os.path.dirname(local_dir)
# Write a cached version even if there isn't a file, so we don't try to # Write a cached version even if there isn't a file, so we don't try to
# fetch it each time. # fetch it each time.
WriteFile(cached_file, content) WriteFile(cached_file, content)
......
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