Warn when git cl upload might be overwriting a newer patchset.
Review URL: https://chromiumcodereview.appspot.com/12646011
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@191895 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_cl.py b/git_cl.py
index 869154c..f836a05 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -1290,6 +1290,15 @@
if not options.reviewers and hook_results.reviewers:
options.reviewers = hook_results.reviewers
+ if cl.GetIssue():
+ latest_patchset = cl.GetMostRecentPatchset(cl.GetIssue())
+ local_patchset = cl.GetPatchset()
+ if local_patchset != latest_patchset:
+ print ('The last upload made from this repository was patchset #%d but '
+ 'the most recent patchset on the server is #%d.'
+ % (local_patchset, latest_patchset))
+ ask_for_data('About to upload; enter to confirm.')
+
print_stats(options.similarity, options.find_copies, args)
if settings.GetIsGerrit():
return GerritUpload(options, args, cl)