Chromium Code Reviews| 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 | |
| 1269 # If non trivial gclient (e.g. includes an Import directive), skip this | |
| 1270 # migration since it would crash either way. | |
| 1271 if any(not hasattr(elem, 'targets') for elem in a.body): | |
|
szager1
2014/08/28 17:22:15
Instead of this, I would prefer you modify the nex
| |
| 1272 return self | |
| 1273 | |
| 1268 solutions = [elem for elem in a.body if 'solutions' in | 1274 solutions = [elem for elem in a.body if 'solutions' in |
| 1269 [target.id for target in elem.targets]] | 1275 [target.id for target in elem.targets]] |
| 1270 if not solutions: | 1276 if not solutions: |
| 1271 return self | 1277 return self |
| 1272 solutions = solutions[-1] | 1278 solutions = solutions[-1] |
| 1273 for solution in solutions.value.elts: | 1279 for solution in solutions.value.elts: |
| 1274 # Check for obsolete URL's | 1280 # Check for obsolete URL's |
| 1275 url_idx = ast_dict_index(solution, 'url') | 1281 url_idx = ast_dict_index(solution, 'url') |
| 1276 if url_idx == -1: | 1282 if url_idx == -1: |
| 1277 continue | 1283 continue |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2194 print >> sys.stderr, 'Error: %s' % str(e) | 2200 print >> sys.stderr, 'Error: %s' % str(e) |
| 2195 return 1 | 2201 return 1 |
| 2196 finally: | 2202 finally: |
| 2197 gclient_utils.PrintWarnings() | 2203 gclient_utils.PrintWarnings() |
| 2198 | 2204 |
| 2199 | 2205 |
| 2200 if '__main__' == __name__: | 2206 if '__main__' == __name__: |
| 2201 sys.exit(Main(sys.argv[1:])) | 2207 sys.exit(Main(sys.argv[1:])) |
| 2202 | 2208 |
| 2203 # vim: ts=2:sw=2:tw=80:et: | 2209 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |