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

Unified Diff: trychange.py

Issue 74163002: Allow PRESUBMIT.py files to have old and new-style trybot specifications (as long as each file is c… (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Address maruel nits. Created 7 years 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 | « tests/presubmit_unittest.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trychange.py
diff --git a/trychange.py b/trychange.py
index fb44c6ed5964571dcb071dab8010659385f373e4..88304f538fd17ed8b4b503b0c88dee248804b90c 100755
--- a/trychange.py
+++ b/trychange.py
@@ -381,14 +381,14 @@ def _GenTSBotSpec(checkouts, change, changed_files, options):
options.verbose,
sys.stdout)
if trybots:
- if isinstance(trybots[0], basestring):
- # PRESUBMIT.py sent us an old-style string list of bots.
- # _ParseBotList's testfilter is set to None otherwise it will complain.
- bot_spec = _ApplyTestFilter(options.testfilter,
- _ParseBotList(trybots, None))
- else:
- # PRESUBMIT.py sent us a new-style (bot, set()) specification.
- bot_spec = _ApplyTestFilter(options.testfilter, trybots)
+ old_style = filter(lambda x: isinstance(x, basestring), trybots)
+ new_style = filter(lambda x: isinstance(x, tuple), trybots)
+
+ # _ParseBotList's testfilter is set to None otherwise it will complain.
+ bot_spec = _ApplyTestFilter(options.testfilter,
+ _ParseBotList(old_style, None))
+
+ bot_spec.extend(_ApplyTestFilter(options.testfilter, new_style))
except ImportError:
pass
« no previous file with comments | « tests/presubmit_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698