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

Unified Diff: trychange.py

Issue 9599012: Stop sending the testfilter= flag to the try server and process it locally. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Fix test to not hardcode my email address! Created 8 years, 9 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 | « tests/trychange_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 4dc3beb831bbcd9b196c3c1962ae3186dfa5522c..9df39f0b04de08d079c7a5201391f8f457264106 100755
--- a/trychange.py
+++ b/trychange.py
@@ -313,10 +313,18 @@ def _ParseSendChangeOptions(options):
if options.project:
values.append(('project', options.project))
- for bot in options.bot:
- values.append(('bot', bot))
- for t in options.testfilter:
- values.append(('testfilter', t))
+ filters = ','.join(options.testfilter)
+ if filters:
+ for bot in options.bot:
+ if ':' in bot:
+ raise ValueError(
+ 'Can\'t use both --testfilter and --bot builder:test formats '
+ 'at the same time')
+ else:
+ values.append(('bot', '%s:%s' % (bot, filters)))
+ else:
+ for bot in options.bot:
+ values.append(('bot', bot))
return values
@@ -488,27 +496,11 @@ def GetMungedDiff(path_diff, diff):
return (diff, changed_files)
-def TryChange(argv,
- change,
- swallow_exception,
- prog=None,
- extra_epilog=None):
- """
- Args:
- argv: Arguments and options.
- change: Change instance corresponding to the CL.
- swallow_exception: Whether we raise or swallow exceptions.
- """
+def gen_parser(prog):
# Parse argv
parser = optparse.OptionParser(usage=USAGE,
version=__version__,
prog=prog)
- epilog = EPILOG % { 'prog': prog }
- if extra_epilog:
- epilog += extra_epilog
- parser.epilog = epilog
- # Remove epilog formatting
- parser.format_epilog = lambda x: parser.epilog
parser.add_option("-v", "--verbose", action="count", default=0,
help="Prints debugging infos")
group = optparse.OptionGroup(parser, "Result and status")
@@ -636,6 +628,27 @@ def TryChange(argv,
help="SVN url to use to write the changes in; --use_svn is "
"implied when using --svn_repo")
parser.add_option_group(group)
+ return parser
+
+
+def TryChange(argv,
+ change,
+ swallow_exception,
+ prog=None,
+ extra_epilog=None):
+ """
+ Args:
+ argv: Arguments and options.
+ change: Change instance corresponding to the CL.
+ swallow_exception: Whether we raise or swallow exceptions.
+ """
+ parser = gen_parser(prog)
+ epilog = EPILOG % { 'prog': prog }
+ if extra_epilog:
+ epilog += extra_epilog
+ parser.epilog = epilog
+ # Remove epilog formatting
+ parser.format_epilog = lambda x: parser.epilog
options, args = parser.parse_args(argv)
« no previous file with comments | « tests/trychange_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698