Commit f75c230c authored by bauerb@chromium.org's avatar bauerb@chromium.org

Warn before uploading more than one commit to Gerrit.

BUG=none

Review URL: https://codereview.chromium.org/259523006

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@267480 0039d316-1c4b-4281-b951-d872f2087c98
parent a779803c
......@@ -1495,6 +1495,16 @@ def GerritUpload(options, args, cl):
return 1
if CHANGE_ID not in change_desc.description:
AddChangeIdToCommitMessage(options, args)
commits = RunGit(['rev-list', '%s/%s...' % (remote, branch)]).splitlines()
if len(commits) > 1:
print('WARNING: This will upload %d commits. Run the following command '
'to see which commits will be uploaded: ' % len(commits))
print('git log %s/%s...' % (remote, branch))
print('You can also use `git squash-branch` to squash these into a single'
'commit.')
ask_for_data('About to upload; enter to confirm.')
if options.reviewers:
change_desc.update_reviewers(options.reviewers)
......
......@@ -588,6 +588,7 @@ class TestGitCl(TestCase):
description)
]
calls += [
((['git', 'rev-list', 'origin/master...'],), ''),
((['git', 'config', 'rietveld.cc'],), '')
]
receive_pack = '--receive-pack=git receive-pack '
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment