OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/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 """Convert SVN based DEPS into .DEPS.git for use with NewGit.""" | 6 """Convert SVN based DEPS into .DEPS.git for use with NewGit.""" |
7 | 7 |
8 import collections | 8 import collections |
9 from cStringIO import StringIO | 9 from cStringIO import StringIO |
10 import json | 10 import json |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 parser.add_option('--no_fail_fast', action='store_true', | 304 parser.add_option('--no_fail_fast', action='store_true', |
305 help='Try to process the whole DEPS, rather than failing ' | 305 help='Try to process the whole DEPS, rather than failing ' |
306 'on the first bad entry.') | 306 'on the first bad entry.') |
307 parser.add_option('--verify', action='store_true', | 307 parser.add_option('--verify', action='store_true', |
308 help='ping each Git repo to make sure it exists') | 308 help='ping each Git repo to make sure it exists') |
309 parser.add_option('--json', | 309 parser.add_option('--json', |
310 help='path to a JSON file for machine-readable output') | 310 help='path to a JSON file for machine-readable output') |
311 options = parser.parse_args()[0] | 311 options = parser.parse_args()[0] |
312 | 312 |
313 # Get the content of the DEPS file. | 313 # Get the content of the DEPS file. |
314 deps, deps_os, include_rules, skip_child_includes, hooks, deps_vars = ( | 314 deps, deps_os, include_rules, skip_child_includes, hooks, deps_vars, recursede
ps = ( |
315 deps_utils.GetDepsContent(options.deps)) | 315 deps_utils.GetDepsContent(options.deps)) |
316 | 316 |
317 if options.extra_rules and options.type: | 317 if options.extra_rules and options.type: |
318 parser.error('Can\'t specify type and extra-rules at the same time.') | 318 parser.error('Can\'t specify type and extra-rules at the same time.') |
319 elif options.type: | 319 elif options.type: |
320 options.extra_rules = os.path.join( | 320 options.extra_rules = os.path.join( |
321 os.path.abspath(os.path.dirname(__file__)), | 321 os.path.abspath(os.path.dirname(__file__)), |
322 'svn_to_git_%s.py' % options.type) | 322 'svn_to_git_%s.py' % options.type) |
323 if options.cache_dir and options.repos: | 323 if options.cache_dir and options.repos: |
324 parser.error('Can\'t specify both cache_dir and repos at the same time.') | 324 parser.error('Can\'t specify both cache_dir and repos at the same time.') |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 if (results.bad_git_urls or results.bad_dep_urls or results.bad_git_hash): | 421 if (results.bad_git_urls or results.bad_dep_urls or results.bad_git_hash): |
422 return 2 | 422 return 2 |
423 | 423 |
424 if options.verify: | 424 if options.verify: |
425 print >> sys.stderr, ('\nAll referenced repositories were successfully ' | 425 print >> sys.stderr, ('\nAll referenced repositories were successfully ' |
426 'resolved.') | 426 'resolved.') |
427 return 0 | 427 return 0 |
428 | 428 |
429 # Write the DEPS file to disk. | 429 # Write the DEPS file to disk. |
430 deps_utils.WriteDeps(options.out, deps_vars, results.new_deps, deps_os, | 430 deps_utils.WriteDeps(options.out, deps_vars, results.new_deps, deps_os, |
431 include_rules, skip_child_includes, hooks) | 431 include_rules, skip_child_includes, hooks, recursedeps) |
432 return 0 | 432 return 0 |
433 | 433 |
434 | 434 |
435 if '__main__' == __name__: | 435 if '__main__' == __name__: |
436 sys.exit(main()) | 436 sys.exit(main()) |
OLD | NEW |