OLD | NEW |
---|---|
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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. |
159 local_path = os.path.join(local_dir, local_base) | 159 local_path = os.path.join(local_dir, local_base) |
160 content, rc = RunShellWithReturnCode(["svn", "status", local_path]) | 160 r = gclient_scm.CaptureSVNStatus((local_path,)) |
161 if not rc and content.startswith('M'): | 161 rc = -1 |
162 if r: | |
163 (status, file) = r[0] | |
164 rc = 0 | |
165 if not rc and (status.startswith('A') or status.startswith('M')): | |
M-A Ruel
2009/11/04 00:38:19
you can do status[0] in ('A', 'M') since it's guar
Dirk Pranke
2009/11/04 01:05:18
Done.
| |
162 content = ReadFile(local_path) | 166 content = ReadFile(local_path) |
163 rc = 0 | 167 rc = 0 |
164 else: | 168 else: |
165 # Then look in the repository. | 169 # Then look in the repository. |
166 svn_path = url_path + "/" + filename | 170 svn_path = url_path + "/" + filename |
167 content, rc = RunShellWithReturnCode(["svn", "cat", svn_path]) | 171 content, rc = RunShellWithReturnCode(["svn", "cat", svn_path]) |
168 | 172 |
169 if not rc: | 173 if not rc: |
170 # Exit the loop if the file was found. Override content. | 174 # Exit the loop if the file was found. Override content. |
171 break | 175 break |
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1270 # the files. This allows commands such as 'gcl diff xxx' to work. | 1274 # the files. This allows commands such as 'gcl diff xxx' to work. |
1271 args =["svn", command] | 1275 args =["svn", command] |
1272 root = GetRepositoryRoot() | 1276 root = GetRepositoryRoot() |
1273 args.extend([os.path.join(root, x) for x in change_info.GetFileNames()]) | 1277 args.extend([os.path.join(root, x) for x in change_info.GetFileNames()]) |
1274 RunShell(args, True) | 1278 RunShell(args, True) |
1275 return 0 | 1279 return 0 |
1276 | 1280 |
1277 | 1281 |
1278 if __name__ == "__main__": | 1282 if __name__ == "__main__": |
1279 sys.exit(main()) | 1283 sys.exit(main()) |
OLD | NEW |