Fix GetCachedFile(use_root=True)

Fix GetCachedFile() to skip local mods when use_root is True. The files
that exist in the root of the tree don't even seem to exist in the normal
source checkouts, and we were looking at a different file as a result.

  BUG=none
  R=maruel@chromium.org
  TEST=locally modify a PRESUBMIT.py file and look for duplicate results. 
    If you get duplicates, this didn't fix it

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@31586 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
dpranke@google.com 16 years ago
parent a31d6586f9
commit 83e9943db5

@ -155,9 +155,11 @@ def GetCachedFile(filename, max_age=60*60*24*3, use_root=False):
url_path = dir_info["URL"]
content = ""
while True:
# First, look for a locally modified version of the file.
local_path = os.path.join(local_dir, local_base)
r = gclient_scm.CaptureSVNStatus((local_path,))
# First, look for a locally modified version of the file if we can.
r = ""
if not use_root:
local_path = os.path.join(local_dir, local_base)
r = gclient_scm.CaptureSVNStatus((local_path,))
rc = -1
if r:
(status, file) = r[0]
@ -166,7 +168,7 @@ def GetCachedFile(filename, max_age=60*60*24*3, use_root=False):
content = ReadFile(local_path)
rc = 0
else:
# Then look in the repository.
# Look in the repository if we didn't find something local.
svn_path = url_path + "/" + filename
content, rc = RunShellWithReturnCode(["svn", "cat", svn_path])

Loading…
Cancel
Save