OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Meta checkout manager supporting both Subversion and GIT.""" | 6 """Meta checkout manager supporting both Subversion and GIT.""" |
7 # Files | 7 # Files |
8 # .gclient : Current client configuration, written by 'config' command. | 8 # .gclient : Current client configuration, written by 'config' command. |
9 # Format is a Python script defining 'solutions', a list whose | 9 # Format is a Python script defining 'solutions', a list whose |
10 # entries each are maps binding the strings "name" and "url" | 10 # entries each are maps binding the strings "name" and "url" |
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 '(trunk|branches/[^/]+)/src') | 1258 '(trunk|branches/[^/]+)/src') |
1259 old_git_re = re.compile('^(https?://git\.chromium\.org|' | 1259 old_git_re = re.compile('^(https?://git\.chromium\.org|' |
1260 'ssh://([a-zA-Z_][a-zA-Z0-9_-]*@)?' | 1260 'ssh://([a-zA-Z_][a-zA-Z0-9_-]*@)?' |
1261 'gerrit\.chromium\.org(:2941[89])?)/' | 1261 'gerrit\.chromium\.org(:2941[89])?)/' |
1262 'chromium/src\.git') | 1262 'chromium/src\.git') |
1263 # Scan existing .gclient file for obsolete settings. It would be simpler | 1263 # Scan existing .gclient file for obsolete settings. It would be simpler |
1264 # to traverse self.dependencies, but working with the AST allows the code to | 1264 # to traverse self.dependencies, but working with the AST allows the code to |
1265 # dump an updated .gclient file that preserves the ordering of the original. | 1265 # dump an updated .gclient file that preserves the ordering of the original. |
1266 a = ast.parse(self.config_content, options.config_filename, 'exec') | 1266 a = ast.parse(self.config_content, options.config_filename, 'exec') |
1267 modified = False | 1267 modified = False |
1268 solutions = [elem for elem in a.body if 'solutions' in | 1268 |
1269 [target.id for target in elem.targets]] | 1269 solutions = [elem for elem in a.body if elem.__class__ is ast.Assign and |
| 1270 'solutions' in [target.id for target in elem.targets]] |
1270 if not solutions: | 1271 if not solutions: |
1271 return self | 1272 return self |
1272 solutions = solutions[-1] | 1273 solutions = solutions[-1] |
1273 for solution in solutions.value.elts: | 1274 for solution in solutions.value.elts: |
| 1275 # Non-trivial assignment to solutions. |
| 1276 if solution.__class__ is not ast.Dict: |
| 1277 continue |
1274 # Check for obsolete URL's | 1278 # Check for obsolete URL's |
1275 url_idx = ast_dict_index(solution, 'url') | 1279 url_idx = ast_dict_index(solution, 'url') |
1276 if url_idx == -1: | 1280 if url_idx == -1: |
1277 continue | 1281 continue |
1278 url_val = solution.values[url_idx] | 1282 url_val = solution.values[url_idx] |
1279 if type(url_val) is not ast.Str: | 1283 if type(url_val) is not ast.Str: |
1280 continue | 1284 continue |
1281 if (svn_url_re.match(url_val.s.strip())): | 1285 if (svn_url_re.match(url_val.s.strip())): |
1282 raise gclient_utils.Error( | 1286 raise gclient_utils.Error( |
1283 """ | 1287 """ |
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2194 print >> sys.stderr, 'Error: %s' % str(e) | 2198 print >> sys.stderr, 'Error: %s' % str(e) |
2195 return 1 | 2199 return 1 |
2196 finally: | 2200 finally: |
2197 gclient_utils.PrintWarnings() | 2201 gclient_utils.PrintWarnings() |
2198 | 2202 |
2199 | 2203 |
2200 if '__main__' == __name__: | 2204 if '__main__' == __name__: |
2201 sys.exit(Main(sys.argv[1:])) | 2205 sys.exit(Main(sys.argv[1:])) |
2202 | 2206 |
2203 # vim: ts=2:sw=2:tw=80:et: | 2207 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |