gclient_eval: Raise an error on implicitly concatenated strings.

Implicitly concatenated strings are not supported when setting new
revisions, so raise an error when attempting to do se.

Bug: 1060772
Change-Id: I74d39b9eb8dcc420e9b7787c90bee642beb783cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2099407
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
This commit is contained in:
Edward Lemur
2020-03-12 17:21:12 +00:00
committed by LUCI CQ
parent 1ee78cdaac
commit 3c11794956
3 changed files with 41 additions and 0 deletions

View File

@@ -759,6 +759,14 @@ def SetRevision(gclient_dict, dep_name, new_revision):
if isinstance(node, ast.BinOp):
node = node.right
token = tokens[node.lineno, node.col_offset][1][1:-1]
if isinstance(node, ast.Str) and token != node.s:
raise ValueError(
'Can\'t update value for %s. Multiline strings and implicitly '
'concatenated strings are not supported.\n'
'Consider reformatting the DEPS file.' % dep_key)
if not isinstance(node, ast.Call) and not isinstance(node, ast.Str):
raise ValueError(
"Unsupported dependency revision format. Please file a bug to the "