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

Side by Side Diff: git_cl.py

Issue 259523006: Warn before uploading more than one commit to Gerrit. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: review Created 6 years, 7 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 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 if options.target_branch: 1487 if options.target_branch:
1488 branch = options.target_branch 1488 branch = options.target_branch
1489 1489
1490 change_desc = ChangeDescription( 1490 change_desc = ChangeDescription(
1491 options.message or CreateDescriptionFromLog(args)) 1491 options.message or CreateDescriptionFromLog(args))
1492 if not change_desc.description: 1492 if not change_desc.description:
1493 print "Description is empty; aborting." 1493 print "Description is empty; aborting."
1494 return 1 1494 return 1
1495 if CHANGE_ID not in change_desc.description: 1495 if CHANGE_ID not in change_desc.description:
1496 AddChangeIdToCommitMessage(options, args) 1496 AddChangeIdToCommitMessage(options, args)
1497
1498 commits = RunGit(['rev-list', '%s/%s...' % (remote, branch)]).splitlines()
1499 if len(commits) > 1:
1500 print('WARNING: This will upload %d commits. Run the following command '
1501 'to see which commits will be uploaded: ' % len(commits))
1502 print('git log %s/%s...' % (remote, branch))
1503 print('You can also use `git squash-branch` to squash these into a single'
1504 'commit.')
1505 ask_for_data('About to upload; enter to confirm.')
1506
1497 if options.reviewers: 1507 if options.reviewers:
1498 change_desc.update_reviewers(options.reviewers) 1508 change_desc.update_reviewers(options.reviewers)
1499 1509
1500 receive_options = [] 1510 receive_options = []
1501 cc = cl.GetCCList().split(',') 1511 cc = cl.GetCCList().split(',')
1502 if options.cc: 1512 if options.cc:
1503 cc.extend(options.cc) 1513 cc.extend(options.cc)
1504 cc = filter(None, cc) 1514 cc = filter(None, cc)
1505 if cc: 1515 if cc:
1506 receive_options += ['--cc=' + email for email in cc] 1516 receive_options += ['--cc=' + email for email in cc]
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
2566 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 2576 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
2567 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 2577 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
2568 2578
2569 2579
2570 if __name__ == '__main__': 2580 if __name__ == '__main__':
2571 # These affect sys.stdout so do it outside of main() to simplify mocks in 2581 # These affect sys.stdout so do it outside of main() to simplify mocks in
2572 # unit testing. 2582 # unit testing.
2573 fix_encoding.fix_encoding() 2583 fix_encoding.fix_encoding()
2574 colorama.init() 2584 colorama.init()
2575 sys.exit(main(sys.argv[1:])) 2585 sys.exit(main(sys.argv[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