From 83e9943db5c49d22bf394114acce2a700587adcf Mon Sep 17 00:00:00 2001 From: "dpranke@google.com" Date: Tue, 10 Nov 2009 19:55:24 +0000 Subject: [PATCH] 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 --- gcl.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gcl.py b/gcl.py index 1b5483e0f..ecc876977 100755 --- a/gcl.py +++ b/gcl.py @@ -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])