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

Unified Diff: gclient.py

Issue 513923006: Skip MigrateConfigToGit if gclient config is non trivial. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Skip non assign statments and strange assign operations Created 6 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient.py
diff --git a/gclient.py b/gclient.py
index 3007487a5930d0f09aeac1260defe3be12bd4360..1cb36d72eb568e90f5a11763bd75d1dff56f392c 100755
--- a/gclient.py
+++ b/gclient.py
@@ -1265,12 +1265,16 @@ want to set 'managed': False in .gclient.
# dump an updated .gclient file that preserves the ordering of the original.
a = ast.parse(self.config_content, options.config_filename, 'exec')
modified = False
- solutions = [elem for elem in a.body if 'solutions' in
- [target.id for target in elem.targets]]
+
+ solutions = [elem for elem in a.body if elem.__class__ is ast.Assign and
+ 'solutions' in [target.id for target in elem.targets]]
if not solutions:
return self
solutions = solutions[-1]
for solution in solutions.value.elts:
+ # Non-trivial assignment to solutions.
+ if solution.__class__ is not ast.Dict:
+ continue
# Check for obsolete URL's
url_idx = ast_dict_index(solution, 'url')
if url_idx == -1:
« 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