 Chromium Code Reviews
 Chromium Code Reviews Issue 10916118:
  Add git cl try that tries from Rietveld.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
    
  
    Issue 10916118:
  Add git cl try that tries from Rietveld.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools| OLD | NEW | 
|---|---|
| 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 Loading... | |
| 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, []).append(tests) | |
| 
Roger Tawa OOO till Jul 10th
2012/09/06 01:33:59
should you split tests by ',' and then extend the
 
M-A Ruel
2012/09/06 07:35:12
done
 | |
| 1577 elif ',' in bot: | |
| 1578 for b in bot.split(','): | |
| 1579 builders_and_tests.setdefault(b, []).append('defaulttests') | |
| 
Roger Tawa OOO till Jul 10th
2012/09/06 01:33:59
the help text at line 1518 does not permit multipl
 
M-A Ruel
2012/09/06 07:35:12
done
 | |
| 1580 else: | |
| 1581 builders_and_tests.setdefault(bot, []).append('defaulttests') | |
| 1582 | |
| 1583 if options.testfilter: | |
| 1584 forced_tests = sum((t.split(',') for t in options.testfilter), []) | |
| 1585 builders_and_tests = dict( | |
| 1586 (b, forced_tests) for b, t in builders_and_tests.iteritems() | |
| 1587 if t != ['compile']) | |
| 1588 | |
| 1589 patchset = cl.GetPatchset() | |
| 1590 if not cl.GetPatchset(): | |
| 1591 properties = cl.RpcServer().get_issue_properties(cl.GetIssue(), False) | |
| 1592 patchset = properties['patchsets'][-1] | |
| 
Roger Tawa OOO till Jul 10th
2012/09/06 01:33:59
i think it should fail if there is no patchset.  b
 
M-A Ruel
2012/09/06 07:35:12
It's because of git cl patch.
 | |
| 1593 | |
| 1594 cl.RpcServer().trigger_try_jobs( | |
| 1595 cl.GetIssue(), patchset, options.name, options.clobber, options.revision, | |
| 1596 builders_and_tests) | |
| 1597 return 0 | |
| 1598 | |
| 1599 | |
| 1513 @usage('[new upstream branch]') | 1600 @usage('[new upstream branch]') | 
| 1514 def CMDupstream(parser, args): | 1601 def CMDupstream(parser, args): | 
| 1515 """prints or sets the name of the upstream branch, if any""" | 1602 """prints or sets the name of the upstream branch, if any""" | 
| 1516 _, args = parser.parse_args(args) | 1603 _, args = parser.parse_args(args) | 
| 1517 if len(args) > 1: | 1604 if len(args) > 1: | 
| 1518 parser.error('Unrecognized args: %s' % ' '.join(args)) | 1605 parser.error('Unrecognized args: %s' % ' '.join(args)) | 
| 1519 return 0 | 1606 return 0 | 
| 1520 | 1607 | 
| 1521 cl = Changelist() | 1608 cl = Changelist() | 
| 1522 if args: | 1609 if args: | 
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1613 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 1700 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 
| 1614 | 1701 | 
| 1615 # Not a known command. Default to help. | 1702 # Not a known command. Default to help. | 
| 1616 GenUsage(parser, 'help') | 1703 GenUsage(parser, 'help') | 
| 1617 return CMDhelp(parser, argv) | 1704 return CMDhelp(parser, argv) | 
| 1618 | 1705 | 
| 1619 | 1706 | 
| 1620 if __name__ == '__main__': | 1707 if __name__ == '__main__': | 
| 1621 fix_encoding.fix_encoding() | 1708 fix_encoding.fix_encoding() | 
| 1622 sys.exit(main(sys.argv[1:])) | 1709 sys.exit(main(sys.argv[1:])) | 
| OLD | NEW |