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: Michael Achenbach <machenbach@chromium.org>
diff --git a/roll_dep_svn.py b/roll_dep_svn.py
index d7af5eb..d564b85 100755
--- a/roll_dep_svn.py
+++ b/roll_dep_svn.py
@@ -223,6 +223,8 @@
     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 @@
   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 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)