OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2014 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 """This scripts takes the path to a dep and an svn revision, and updates the | 6 """This scripts takes the path to a dep and an svn revision, and updates the |
7 parent repo's DEPS file with the corresponding git revision. Sample invocation: | 7 parent repo's DEPS file with the corresponding git revision. Sample invocation: |
8 | 8 |
9 [chromium/src]$ roll-dep third_party/WebKit 12345 | 9 [chromium/src]$ roll-dep third_party/WebKit 12345 |
10 | 10 |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 if deps_os_node: | 317 if deps_os_node: |
318 for (os_name, os_node) in izip(deps_os_node.keys, deps_os_node.values): | 318 for (os_name, os_node) in izip(deps_os_node.keys, deps_os_node.values): |
319 dep_idx = find_dict_index(os_node, dep_name) | 319 dep_idx = find_dict_index(os_node, dep_name) |
320 if dep_idx is not None: | 320 if dep_idx is not None: |
321 value_node = os_node.values[dep_idx] | 321 value_node = os_node.values[dep_idx] |
322 if value_node.__class__ is ast.Name and value_node.id == 'None': | 322 if value_node.__class__ is ast.Name and value_node.id == 'None': |
323 pass | 323 pass |
324 else: | 324 else: |
325 update_deps_entry(deps_lines, deps_ast, value_node, new_rev, comment) | 325 update_deps_entry(deps_lines, deps_ast, value_node, new_rev, comment) |
326 commit_msg = generate_commit_message( | 326 commit_msg = generate_commit_message( |
327 deps_locals['deps_os'][os_name], dep_path, dep_name, new_rev) | 327 deps_locals['deps_os'][os_name.s], dep_path, dep_name, new_rev) |
328 if commit_msg: | 328 if commit_msg: |
329 print 'Pinning %s' % dep_name | 329 print 'Pinning %s' % dep_name |
330 print 'to revision %s' % new_rev | 330 print 'to revision %s' % new_rev |
331 print 'in %s' % deps_file | 331 print 'in %s' % deps_file |
332 with open(deps_file, 'w') as fh: | 332 with open(deps_file, 'w') as fh: |
333 for line in deps_lines: | 333 for line in deps_lines: |
334 print >> fh, line | 334 print >> fh, line |
335 deps_file_dir = os.path.normpath(os.path.dirname(deps_file)) | 335 deps_file_dir = os.path.normpath(os.path.dirname(deps_file)) |
336 deps_file_root = Popen( | 336 deps_file_root = Popen( |
337 ['git', 'rev-parse', '--show-toplevel'], | 337 ['git', 'rev-parse', '--show-toplevel'], |
(...skipping 23 matching lines...) Expand all Loading... |
361 soln_path = os.path.relpath(os.path.join(gclient_root, soln['name'])) | 361 soln_path = os.path.relpath(os.path.join(gclient_root, soln['name'])) |
362 deps_file = os.path.join(soln_path, 'DEPS') | 362 deps_file = os.path.join(soln_path, 'DEPS') |
363 dep_name = posix_path(os.path.relpath(dep_path, gclient_root)) | 363 dep_name = posix_path(os.path.relpath(dep_path, gclient_root)) |
364 (git_rev, svn_rev) = get_git_revision(dep_path, revision) | 364 (git_rev, svn_rev) = get_git_revision(dep_path, revision) |
365 comment = ('from svn revision %s' % svn_rev) if svn_rev else None | 365 comment = ('from svn revision %s' % svn_rev) if svn_rev else None |
366 assert git_rev, 'Could not find git revision matching %s.' % revision | 366 assert git_rev, 'Could not find git revision matching %s.' % revision |
367 return update_deps(deps_file, dep_path, dep_name, git_rev, comment) | 367 return update_deps(deps_file, dep_path, dep_name, git_rev, comment) |
368 | 368 |
369 if __name__ == '__main__': | 369 if __name__ == '__main__': |
370 sys.exit(main(sys.argv[1:])) | 370 sys.exit(main(sys.argv[1:])) |
OLD | NEW |