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

Side by Side Diff: deps2git.py

Issue 493483002: Retain original DEPS 'vars' in converted .DEPS.git. (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/deps2git
Patch Set: Created 6 years, 4 months 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 | deps_utils.py » ('j') | 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) 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 parser.add_option('--no_fail_fast', action='store_true', 303 parser.add_option('--no_fail_fast', action='store_true',
304 help='Try to process the whole DEPS, rather than failing ' 304 help='Try to process the whole DEPS, rather than failing '
305 'on the first bad entry.') 305 'on the first bad entry.')
306 parser.add_option('--verify', action='store_true', 306 parser.add_option('--verify', action='store_true',
307 help='ping each Git repo to make sure it exists') 307 help='ping each Git repo to make sure it exists')
308 parser.add_option('--json', 308 parser.add_option('--json',
309 help='path to a JSON file for machine-readable output') 309 help='path to a JSON file for machine-readable output')
310 options = parser.parse_args()[0] 310 options = parser.parse_args()[0]
311 311
312 # Get the content of the DEPS file. 312 # Get the content of the DEPS file.
313 deps, deps_os, include_rules, skip_child_includes, hooks = ( 313 deps, deps_os, include_rules, skip_child_includes, hooks, deps_vars = (
314 deps_utils.GetDepsContent(options.deps)) 314 deps_utils.GetDepsContent(options.deps))
315 315
316 if options.extra_rules and options.type: 316 if options.extra_rules and options.type:
317 parser.error('Can\'t specify type and extra-rules at the same time.') 317 parser.error('Can\'t specify type and extra-rules at the same time.')
318 elif options.type: 318 elif options.type:
319 options.extra_rules = os.path.join( 319 options.extra_rules = os.path.join(
320 os.path.abspath(os.path.dirname(__file__)), 320 os.path.abspath(os.path.dirname(__file__)),
321 'svn_to_git_%s.py' % options.type) 321 'svn_to_git_%s.py' % options.type)
322 if options.cache_dir and options.repos: 322 if options.cache_dir and options.repos:
323 parser.error('Can\'t specify both cache_dir and repos at the same time.') 323 parser.error('Can\'t specify both cache_dir and repos at the same time.')
324 if options.shallow and not options.cache_dir: 324 if options.shallow and not options.cache_dir:
325 parser.error('--shallow only supported with --cache_dir.') 325 parser.error('--shallow only supported with --cache_dir.')
326 326
327 if options.cache_dir: 327 if options.cache_dir:
328 options.cache_dir = os.path.abspath(options.cache_dir) 328 options.cache_dir = os.path.abspath(options.cache_dir)
329 329
330 if options.extra_rules and not os.path.exists(options.extra_rules): 330 if options.extra_rules and not os.path.exists(options.extra_rules):
331 raise RuntimeError('Can\'t locate rules file "%s".' % options.extra_rules) 331 raise RuntimeError('Can\'t locate rules file "%s".' % options.extra_rules)
332 332
333 # Create a var containing the Git and Webkit URL, this will make it easy for 333 # Create a var containing the Git and Webkit URL, this will make it easy for
334 # people to use a mirror instead. 334 # people to use a mirror instead.
335 git_url = 'https://chromium.googlesource.com' 335 git_url = 'https://chromium.googlesource.com'
336 deps_vars = { 336 deps_vars.update({
337 'git_url': git_url, 337 'git_url': git_url,
338 'webkit_url': git_url + '/chromium/blink.git', 338 'webkit_url': git_url + '/chromium/blink.git',
339 } 339 })
340 340
341 # Find and load svn_to_git_* modules that handle the URL mapping. 341 # Find and load svn_to_git_* modules that handle the URL mapping.
342 svn_to_git_objs = [svn_to_git_public] 342 svn_to_git_objs = [svn_to_git_public]
343 if options.extra_rules: 343 if options.extra_rules:
344 rules_dir, rules_file = os.path.split(options.extra_rules) 344 rules_dir, rules_file = os.path.split(options.extra_rules)
345 rules_file_base = os.path.splitext(rules_file)[0] 345 rules_file_base = os.path.splitext(rules_file)[0]
346 sys.path.insert(0, rules_dir) 346 sys.path.insert(0, rules_dir)
347 svn_to_git_mod = __import__(rules_file_base) 347 svn_to_git_mod = __import__(rules_file_base)
348 svn_to_git_objs.insert(0, svn_to_git_mod) 348 svn_to_git_objs.insert(0, svn_to_git_mod)
349 349
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 return 0 426 return 0
427 427
428 # Write the DEPS file to disk. 428 # Write the DEPS file to disk.
429 deps_utils.WriteDeps(options.out, deps_vars, results.new_deps, deps_os, 429 deps_utils.WriteDeps(options.out, deps_vars, results.new_deps, deps_os,
430 include_rules, skip_child_includes, hooks) 430 include_rules, skip_child_includes, hooks)
431 return 0 431 return 0
432 432
433 433
434 if '__main__' == __name__: 434 if '__main__' == __name__:
435 sys.exit(main()) 435 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | deps_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698