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

Side by Side Diff: git_cl.py

Issue 10916118: Add git cl try that tries from Rietveld. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Address review comments Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # Copyright (C) 2008 Evan Martin <martine@danga.com> 6 # Copyright (C) 2008 Evan Martin <martine@danga.com>
7 7
8 """A git-command for integrating reviews on Rietveld.""" 8 """A git-command for integrating reviews on Rietveld."""
9 9
10 import json 10 import json
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 return 2 1503 return 2
1504 1504
1505 print "The tree is %s" % status 1505 print "The tree is %s" % status
1506 print 1506 print
1507 print GetTreeStatusReason() 1507 print GetTreeStatusReason()
1508 if status != 'open': 1508 if status != 'open':
1509 return 1 1509 return 1
1510 return 0 1510 return 0
1511 1511
1512 1512
1513 def CMDtry(parser, args):
1514 """Triggers a try job through Rietveld."""
1515 group = optparse.OptionGroup(parser, "Try job options")
1516 group.add_option(
1517 "-b", "--bot", action="append",
1518 help=("IMPORTANT: specify ONE builder per --bot flag. Use it multiple "
1519 "times to specify multiple builders. ex: "
1520 "'-bwin_rel:ui_tests,webkit_unit_tests -bwin_layout'. See "
1521 "the try server waterfall for the builders name and the tests "
1522 "available. Can also be used to specify gtest_filter, e.g. "
1523 "-bwin_rel:base_unittests:ValuesTest.*Value"))
1524 group.add_option(
1525 "-r", "--revision",
1526 help="Revision to use for the try job; default: the "
1527 "revision will be determined by the try server; see "
1528 "its waterfall for more info")
1529 group.add_option(
1530 "-c", "--clobber", action="store_true", default=False,
1531 help="Force a clobber before building; e.g. don't do an "
1532 "incremental build")
1533 group.add_option(
1534 "--project",
1535 help="Override which project to use. Projects are defined "
1536 "server-side to define what default bot set to use")
1537 group.add_option(
1538 "-t", "--testfilter", action="append", default=[],
1539 help=("Apply a testfilter to all the selected builders. Unless the "
1540 "builders configurations are similar, use multiple "
1541 "--bot <builder>:<test> arguments."))
1542 group.add_option(
1543 "-n", "--name", help="Try job name; default to current branch name")
1544 parser.add_option_group(group)
1545 options, args = parser.parse_args(args)
1546
1547 if args:
1548 parser.error('Unknown arguments: %s' % args)
1549
1550 cl = Changelist()
1551 if not cl.GetIssue():
1552 parser.error('Need to upload first')
1553
1554 if not options.name:
1555 options.name = cl.GetBranch()
1556
1557 # Process --bot and --testfilter.
1558 if not options.bot:
1559 # Get try slaves from PRESUBMIT.py files if not specified.
1560 change = cl.GetChange(cl.GetUpstreamBranch(), None)
1561 options.bot = presubmit_support.DoGetTrySlaves(
1562 change,
1563 change.LocalPaths(),
1564 settings.GetRoot(),
1565 None,
1566 None,
1567 options.verbose,
1568 sys.stdout)
1569 if not options.bot:
1570 parser.error('No default try builder to try, use --bot')
1571
1572 builders_and_tests = {}
1573 for bot in options.bot:
1574 if ':' in bot:
1575 builder, tests = bot.split(':', 1)
1576 builders_and_tests.setdefault(builder, []).extend(tests.split(','))
1577 elif ',' in bot:
1578 parser.error('Specify one bot per --bot flag')
1579 else:
1580 builders_and_tests.setdefault(bot, []).append('defaulttests')
1581
1582 if options.testfilter:
1583 forced_tests = sum((t.split(',') for t in options.testfilter), [])
1584 builders_and_tests = dict(
1585 (b, forced_tests) for b, t in builders_and_tests.iteritems()
1586 if t != ['compile'])
1587
1588 patchset = cl.GetPatchset()
1589 if not cl.GetPatchset():
1590 properties = cl.RpcServer().get_issue_properties(cl.GetIssue(), False)
1591 patchset = properties['patchsets'][-1]
1592
1593 cl.RpcServer().trigger_try_jobs(
1594 cl.GetIssue(), patchset, options.name, options.clobber, options.revision,
1595 builders_and_tests)
1596 return 0
1597
1598
1513 @usage('[new upstream branch]') 1599 @usage('[new upstream branch]')
1514 def CMDupstream(parser, args): 1600 def CMDupstream(parser, args):
1515 """prints or sets the name of the upstream branch, if any""" 1601 """prints or sets the name of the upstream branch, if any"""
1516 _, args = parser.parse_args(args) 1602 _, args = parser.parse_args(args)
1517 if len(args) > 1: 1603 if len(args) > 1:
1518 parser.error('Unrecognized args: %s' % ' '.join(args)) 1604 parser.error('Unrecognized args: %s' % ' '.join(args))
1519 return 0 1605 return 0
1520 1606
1521 cl = Changelist() 1607 cl = Changelist()
1522 if args: 1608 if args:
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 1699 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
1614 1700
1615 # Not a known command. Default to help. 1701 # Not a known command. Default to help.
1616 GenUsage(parser, 'help') 1702 GenUsage(parser, 'help')
1617 return CMDhelp(parser, argv) 1703 return CMDhelp(parser, argv)
1618 1704
1619 1705
1620 if __name__ == '__main__': 1706 if __name__ == '__main__':
1621 fix_encoding.fix_encoding() 1707 fix_encoding.fix_encoding()
1622 sys.exit(main(sys.argv[1:])) 1708 sys.exit(main(sys.argv[1:]))
OLDNEW
« 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