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

Side by Side Diff: roll_dep.py

Issue 686183003: Fix handling of ast.Str object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 1 month 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 | no next file » | 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/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
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
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:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698