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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index e8cadf270d1d9a7f85aed299e41f2bb328499b66..f99d0913bb1cd8cc6cde201adfa85e3b39a40e89 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -1494,6 +1494,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)
« 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