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

Side by Side Diff: depot_tools/git_cl.py

Issue 501503002: Stop git cl using CQ_TRYBOTS. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools/@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | depot_tools/tests/git_cl_test.py » ('j') | 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 from distutils.version import LooseVersion 10 from distutils.version import LooseVersion
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 git_command = ['push'] 1563 git_command = ['push']
1564 if receive_options: 1564 if receive_options:
1565 git_command.append('--receive-pack=git receive-pack %s' % 1565 git_command.append('--receive-pack=git receive-pack %s' %
1566 ' '.join(receive_options)) 1566 ' '.join(receive_options))
1567 git_command += [remote, 'HEAD:refs/for/' + branch] 1567 git_command += [remote, 'HEAD:refs/for/' + branch]
1568 RunGit(git_command) 1568 RunGit(git_command)
1569 # TODO(ukai): parse Change-Id: and set issue number? 1569 # TODO(ukai): parse Change-Id: and set issue number?
1570 return 0 1570 return 0
1571 1571
1572 1572
1573 def RietveldUpload(options, args, cl, change): 1573 def RietveldUpload(options, args, cl):
1574 """upload the patch to rietveld.""" 1574 """upload the patch to rietveld."""
1575 upload_args = ['--assume_yes'] # Don't ask about untracked files. 1575 upload_args = ['--assume_yes'] # Don't ask about untracked files.
1576 upload_args.extend(['--server', cl.GetRietveldServer()]) 1576 upload_args.extend(['--server', cl.GetRietveldServer()])
1577 if options.emulate_svn_auto_props: 1577 if options.emulate_svn_auto_props:
1578 upload_args.append('--emulate_svn_auto_props') 1578 upload_args.append('--emulate_svn_auto_props')
1579 1579
1580 change_desc = None 1580 change_desc = None
1581 1581
1582 if options.email is not None: 1582 if options.email is not None:
1583 upload_args.extend(['--email', options.email]) 1583 upload_args.extend(['--email', options.email])
1584 1584
1585 if cl.GetIssue(): 1585 if cl.GetIssue():
1586 if options.title: 1586 if options.title:
1587 upload_args.extend(['--title', options.title]) 1587 upload_args.extend(['--title', options.title])
1588 if options.message: 1588 if options.message:
1589 upload_args.extend(['--message', options.message]) 1589 upload_args.extend(['--message', options.message])
1590 upload_args.extend(['--issue', str(cl.GetIssue())]) 1590 upload_args.extend(['--issue', str(cl.GetIssue())])
1591 print ("This branch is associated with issue %s. " 1591 print ("This branch is associated with issue %s. "
1592 "Adding patch to that issue." % cl.GetIssue()) 1592 "Adding patch to that issue." % cl.GetIssue())
1593 else: 1593 else:
1594 if options.title: 1594 if options.title:
1595 upload_args.extend(['--title', options.title]) 1595 upload_args.extend(['--title', options.title])
1596 message = options.title or options.message or CreateDescriptionFromLog(args) 1596 message = options.title or options.message or CreateDescriptionFromLog(args)
1597 change_desc = ChangeDescription(message) 1597 change_desc = ChangeDescription(message)
1598 if options.reviewers: 1598 if options.reviewers:
1599 change_desc.update_reviewers(options.reviewers) 1599 change_desc.update_reviewers(options.reviewers)
1600 if options.auto_bots:
1601 masters = presubmit_support.DoGetTryMasters(
1602 change,
1603 change.LocalPaths(),
1604 settings.GetRoot(),
1605 None,
1606 None,
1607 options.verbose,
1608 sys.stdout)
1609
1610 if masters:
1611 change_description = change_desc.description + '\nCQ_TRYBOTS='
1612 lst = []
1613 for master, mapping in masters.iteritems():
1614 lst.append(master + ':' + ','.join(mapping.keys()))
1615 change_desc.set_description(change_description + ';'.join(lst))
1616 if not options.force: 1600 if not options.force:
1617 change_desc.prompt() 1601 change_desc.prompt()
1618 1602
1619 if not change_desc.description: 1603 if not change_desc.description:
1620 print "Description is empty; aborting." 1604 print "Description is empty; aborting."
1621 return 1 1605 return 1
1622 1606
1623 upload_args.extend(['--message', change_desc.description]) 1607 upload_args.extend(['--message', change_desc.description])
1624 if change_desc.get_reviewers(): 1608 if change_desc.get_reviewers():
1625 upload_args.append('--reviewers=' + ','.join(change_desc.get_reviewers())) 1609 upload_args.append('--reviewers=' + ','.join(change_desc.get_reviewers()))
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1739 parser.add_option('-c', '--use-commit-queue', action='store_true', 1723 parser.add_option('-c', '--use-commit-queue', action='store_true',
1740 help='tell the commit queue to commit this patchset') 1724 help='tell the commit queue to commit this patchset')
1741 parser.add_option('--private', action='store_true', 1725 parser.add_option('--private', action='store_true',
1742 help='set the review private (rietveld only)') 1726 help='set the review private (rietveld only)')
1743 parser.add_option('--target_branch', 1727 parser.add_option('--target_branch',
1744 '--target-branch', 1728 '--target-branch',
1745 help='When uploading to gerrit, remote branch to ' 1729 help='When uploading to gerrit, remote branch to '
1746 'use for CL. Default: master') 1730 'use for CL. Default: master')
1747 parser.add_option('--email', default=None, 1731 parser.add_option('--email', default=None,
1748 help='email address to use to connect to Rietveld') 1732 help='email address to use to connect to Rietveld')
1749 parser.add_option('--auto-bots', default=False, action='store_true',
1750 help='Autogenerate which trybots to use for this CL')
1751 1733
1752 add_git_similarity(parser) 1734 add_git_similarity(parser)
1753 (options, args) = parser.parse_args(args) 1735 (options, args) = parser.parse_args(args)
1754 1736
1755 if options.target_branch and not settings.GetIsGerrit(): 1737 if options.target_branch and not settings.GetIsGerrit():
1756 parser.error('Use --target_branch for non gerrit repository.') 1738 parser.error('Use --target_branch for non gerrit repository.')
1757 1739
1758 if is_dirty_git_tree('upload'): 1740 if is_dirty_git_tree('upload'):
1759 return 1 1741 return 1
1760 1742
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1800 'the most recent patchset on the server is #%d.' 1782 'the most recent patchset on the server is #%d.'
1801 % (local_patchset, latest_patchset)) 1783 % (local_patchset, latest_patchset))
1802 print ('Uploading will still work, but if you\'ve uploaded to this issue ' 1784 print ('Uploading will still work, but if you\'ve uploaded to this issue '
1803 'from another machine or branch the patch you\'re uploading now ' 1785 'from another machine or branch the patch you\'re uploading now '
1804 'might not include those changes.') 1786 'might not include those changes.')
1805 ask_for_data('About to upload; enter to confirm.') 1787 ask_for_data('About to upload; enter to confirm.')
1806 1788
1807 print_stats(options.similarity, options.find_copies, args) 1789 print_stats(options.similarity, options.find_copies, args)
1808 if settings.GetIsGerrit(): 1790 if settings.GetIsGerrit():
1809 return GerritUpload(options, args, cl) 1791 return GerritUpload(options, args, cl)
1810 ret = RietveldUpload(options, args, cl, change) 1792 ret = RietveldUpload(options, args, cl)
1811 if not ret: 1793 if not ret:
1812 git_set_branch_value('last-upload-hash', 1794 git_set_branch_value('last-upload-hash',
1813 RunGit(['rev-parse', 'HEAD']).strip()) 1795 RunGit(['rev-parse', 'HEAD']).strip())
1814 1796
1815 return ret 1797 return ret
1816 1798
1817 1799
1818 def IsSubmoduleMergeCommit(ref): 1800 def IsSubmoduleMergeCommit(ref):
1819 # When submodules are added to the repo, we expect there to be a single 1801 # When submodules are added to the repo, we expect there to be a single
1820 # non-git-svn merge commit at remote HEAD with a signature comment. 1802 # non-git-svn merge commit at remote HEAD with a signature comment.
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
2755 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 2737 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
2756 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 2738 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
2757 2739
2758 2740
2759 if __name__ == '__main__': 2741 if __name__ == '__main__':
2760 # These affect sys.stdout so do it outside of main() to simplify mocks in 2742 # These affect sys.stdout so do it outside of main() to simplify mocks in
2761 # unit testing. 2743 # unit testing.
2762 fix_encoding.fix_encoding() 2744 fix_encoding.fix_encoding()
2763 colorama.init() 2745 colorama.init()
2764 sys.exit(main(sys.argv[1:])) 2746 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | depot_tools/tests/git_cl_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698