Commit e83d0244 authored by Paweł Hajdan, Jr's avatar Paweł Hajdan, Jr Committed by Commit Bot

Update roll_dep_svn for new DEPS syntax

Bug: 772843
Change-Id: I994f829cba7577e6b628d36d894f4c5d1f3c429c
Reviewed-on: https://chromium-review.googlesource.com/708656
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
parent 6bba5a9b
......@@ -223,6 +223,8 @@ def update_node(deps_lines, deps_ast, node, git_revision):
return update_binop(deps_lines, deps_ast, node, git_revision)
elif node.__class__ is ast.Call:
return update_call(deps_lines, deps_ast, node, git_revision)
elif node.__class__ is ast.Dict:
return update_dict(deps_lines, deps_ast, node, git_revision)
else:
assert False, ast_err_msg(node)
......@@ -260,6 +262,13 @@ def update_call(deps_lines, deps_ast, call_node, git_revision):
return update_var(deps_lines, deps_ast, call_node.args[0].s, git_revision)
def update_dict(deps_lines, deps_ast, dict_node, git_revision):
"""Update a dict node in the AST with the new git revision."""
for key, value in zip(dict_node.keys, dict_node.values):
if key.__class__ is ast.Str and key.s == 'url':
return update_node(deps_lines, deps_ast, value, git_revision)
def update_var(deps_lines, deps_ast, var_name, git_revision):
"""Update an entry in the vars section of the DEPS file with the new
git revision."""
......@@ -278,7 +287,11 @@ def short_rev(rev, dep_path):
def generate_commit_message(deps_section, dep_path, dep_name, new_rev):
(url, _, old_rev) = deps_section[dep_name].partition('@')
dep_url = deps_section[dep_name]
if isinstance(dep_url, dict):
dep_url = dep_url['url']
(url, _, old_rev) = dep_url.partition('@')
if url.endswith('.git'):
url = url[:-4]
old_rev_short = short_rev(old_rev, dep_path)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment