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

Side by Side Diff: git_cl.py

Issue 1659633003: Abort if a patch set title is provided for a Gerrit server (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 years, 10 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 | 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 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 print 1620 print
1621 1621
1622 if not dependents: 1622 if not dependents:
1623 print 'There are no dependent local branches for %s' % root_branch 1623 print 'There are no dependent local branches for %s' % root_branch
1624 return 0 1624 return 0
1625 1625
1626 print ('This command will checkout all dependent branches and run ' 1626 print ('This command will checkout all dependent branches and run '
1627 '"git cl upload".') 1627 '"git cl upload".')
1628 ask_for_data('[Press enter to continue or ctrl-C to quit]') 1628 ask_for_data('[Press enter to continue or ctrl-C to quit]')
1629 1629
1630 # Add a default patchset title to all upload calls. 1630 # Add a default patchset title to all upload calls in Rietveld.
1631 args.extend(['-t', 'Updated patchset dependency']) 1631 if not settings.GetIsGerrit():
1632 args.extend(['-t', 'Updated patchset dependency'])
1633
1632 # Record all dependents that failed to upload. 1634 # Record all dependents that failed to upload.
1633 failures = {} 1635 failures = {}
1634 # Go through all dependents, checkout the branch and upload. 1636 # Go through all dependents, checkout the branch and upload.
1635 try: 1637 try:
1636 for dependent_branch in dependents: 1638 for dependent_branch in dependents:
1637 print 1639 print
1638 print '--------------------------------------' 1640 print '--------------------------------------'
1639 print 'Running "git cl upload" from %s:' % dependent_branch 1641 print 'Running "git cl upload" from %s:' % dependent_branch
1640 RunGit(['checkout', '-q', dependent_branch]) 1642 RunGit(['checkout', '-q', dependent_branch])
1641 print 1643 print
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
2003 # It is probably not worthwhile to support different workflows. 2005 # It is probably not worthwhile to support different workflows.
2004 gerrit_remote = 'origin' 2006 gerrit_remote = 'origin'
2005 2007
2006 remote, remote_branch = cl.GetRemoteBranch() 2008 remote, remote_branch = cl.GetRemoteBranch()
2007 branch = GetTargetRef(remote, remote_branch, options.target_branch, 2009 branch = GetTargetRef(remote, remote_branch, options.target_branch,
2008 pending_prefix='') 2010 pending_prefix='')
2009 2011
2010 change_desc = ChangeDescription( 2012 change_desc = ChangeDescription(
2011 options.message or CreateDescriptionFromLog(args)) 2013 options.message or CreateDescriptionFromLog(args))
2012 if not change_desc.description: 2014 if not change_desc.description:
2013 print "Description is empty; aborting." 2015 print "\nDescription is empty. Aborting..."
2016 return 1
2017
2018 if options.title:
2019 print "\nPatch titles (-t) are not supported in Gerrit. Aborting..."
2014 return 1 2020 return 1
2015 2021
2016 if options.squash: 2022 if options.squash:
2017 # Try to get the message from a previous upload. 2023 # Try to get the message from a previous upload.
2018 shadow_branch = 'refs/heads/git_cl_uploads/' + cl.GetBranch() 2024 shadow_branch = 'refs/heads/git_cl_uploads/' + cl.GetBranch()
2019 message = RunGitSilent(['show', '--format=%s\n\n%b', '-s', shadow_branch]) 2025 message = RunGitSilent(['show', '--format=%s\n\n%b', '-s', shadow_branch])
2020 if not message: 2026 if not message:
2021 if not options.force: 2027 if not options.force:
2022 change_desc.prompt() 2028 change_desc.prompt()
2023 2029
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
2344 Can also set the above globally by using the --global flag. 2350 Can also set the above globally by using the --global flag.
2345 """ 2351 """
2346 parser.add_option('--bypass-hooks', action='store_true', dest='bypass_hooks', 2352 parser.add_option('--bypass-hooks', action='store_true', dest='bypass_hooks',
2347 help='bypass upload presubmit hook') 2353 help='bypass upload presubmit hook')
2348 parser.add_option('--bypass-watchlists', action='store_true', 2354 parser.add_option('--bypass-watchlists', action='store_true',
2349 dest='bypass_watchlists', 2355 dest='bypass_watchlists',
2350 help='bypass watchlists auto CC-ing reviewers') 2356 help='bypass watchlists auto CC-ing reviewers')
2351 parser.add_option('-f', action='store_true', dest='force', 2357 parser.add_option('-f', action='store_true', dest='force',
2352 help="force yes to questions (don't prompt)") 2358 help="force yes to questions (don't prompt)")
2353 parser.add_option('-m', dest='message', help='message for patchset') 2359 parser.add_option('-m', dest='message', help='message for patchset')
2354 parser.add_option('-t', dest='title', help='title for patchset') 2360 parser.add_option('-t', dest='title',
2361 help='title for patchset (Rietveld only)')
2355 parser.add_option('-r', '--reviewers', 2362 parser.add_option('-r', '--reviewers',
2356 action='append', default=[], 2363 action='append', default=[],
2357 help='reviewer email addresses') 2364 help='reviewer email addresses')
2358 parser.add_option('--cc', 2365 parser.add_option('--cc',
2359 action='append', default=[], 2366 action='append', default=[],
2360 help='cc email addresses') 2367 help='cc email addresses')
2361 parser.add_option('-s', '--send-mail', action='store_true', 2368 parser.add_option('-s', '--send-mail', action='store_true',
2362 help='send email to reviewer immediately') 2369 help='send email to reviewer immediately')
2363 parser.add_option('--emulate_svn_auto_props', 2370 parser.add_option('--emulate_svn_auto_props',
2364 '--emulate-svn-auto-props', 2371 '--emulate-svn-auto-props',
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after
3715 if __name__ == '__main__': 3722 if __name__ == '__main__':
3716 # These affect sys.stdout so do it outside of main() to simplify mocks in 3723 # These affect sys.stdout so do it outside of main() to simplify mocks in
3717 # unit testing. 3724 # unit testing.
3718 fix_encoding.fix_encoding() 3725 fix_encoding.fix_encoding()
3719 colorama.init() 3726 colorama.init()
3720 try: 3727 try:
3721 sys.exit(main(sys.argv[1:])) 3728 sys.exit(main(sys.argv[1:]))
3722 except KeyboardInterrupt: 3729 except KeyboardInterrupt:
3723 sys.stderr.write('interrupted\n') 3730 sys.stderr.write('interrupted\n')
3724 sys.exit(1) 3731 sys.exit(1)
OLDNEW
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698