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

Side by Side Diff: gcl.py

Issue 379021: Fix GetCachedFile(use_root=True)... (Closed) Base URL: svn://chrome-svn/chrome/trunk/tools/depot_tools/
Patch Set: Created 11 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 # 5 #
6 # Wrapper script around Rietveld's upload.py that groups files into 6 # Wrapper script around Rietveld's upload.py that groups files into
7 # changelists. 7 # changelists.
8 8
9 import getpass 9 import getpass
10 import os 10 import os
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 local_dir = os.path.dirname(os.path.abspath(filename)) 148 local_dir = os.path.dirname(os.path.abspath(filename))
149 local_base = os.path.basename(filename) 149 local_base = os.path.basename(filename)
150 dir_info = gclient_scm.CaptureSVNInfo(".") 150 dir_info = gclient_scm.CaptureSVNInfo(".")
151 repo_root = dir_info["Repository Root"] 151 repo_root = dir_info["Repository Root"]
152 if use_root: 152 if use_root:
153 url_path = repo_root 153 url_path = repo_root
154 else: 154 else:
155 url_path = dir_info["URL"] 155 url_path = dir_info["URL"]
156 content = "" 156 content = ""
157 while True: 157 while True:
158 # First, look for a locally modified version of the file. 158 # First, look for a locally modified version of the file if we can.
159 local_path = os.path.join(local_dir, local_base) 159 r = ""
160 r = gclient_scm.CaptureSVNStatus((local_path,)) 160 if not use_root:
161 local_path = os.path.join(local_dir, local_base)
162 r = gclient_scm.CaptureSVNStatus((local_path,))
161 rc = -1 163 rc = -1
162 if r: 164 if r:
163 (status, file) = r[0] 165 (status, file) = r[0]
164 rc = 0 166 rc = 0
165 if not rc and status[0] in ('A','M'): 167 if not rc and status[0] in ('A','M'):
166 content = ReadFile(local_path) 168 content = ReadFile(local_path)
167 rc = 0 169 rc = 0
168 else: 170 else:
169 # Then look in the repository. 171 # Look in the repository if we didn't find something local.
170 svn_path = url_path + "/" + filename 172 svn_path = url_path + "/" + filename
171 content, rc = RunShellWithReturnCode(["svn", "cat", svn_path]) 173 content, rc = RunShellWithReturnCode(["svn", "cat", svn_path])
172 174
173 if not rc: 175 if not rc:
174 # Exit the loop if the file was found. Override content. 176 # Exit the loop if the file was found. Override content.
175 break 177 break
176 # Make sure to mark settings as empty if not found. 178 # Make sure to mark settings as empty if not found.
177 content = "" 179 content = ""
178 if url_path == repo_root: 180 if url_path == repo_root:
179 # Reached the root. Abandoning search. 181 # Reached the root. Abandoning search.
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 # the files. This allows commands such as 'gcl diff xxx' to work. 1287 # the files. This allows commands such as 'gcl diff xxx' to work.
1286 args =["svn", command] 1288 args =["svn", command]
1287 root = GetRepositoryRoot() 1289 root = GetRepositoryRoot()
1288 args.extend([os.path.join(root, x) for x in change_info.GetFileNames()]) 1290 args.extend([os.path.join(root, x) for x in change_info.GetFileNames()])
1289 RunShell(args, True) 1291 RunShell(args, True)
1290 return 0 1292 return 0
1291 1293
1292 1294
1293 if __name__ == "__main__": 1295 if __name__ == "__main__":
1294 sys.exit(main()) 1296 sys.exit(main())
OLDNEW
« 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