From cc50bac8c7706082596d70756249d4964a67f281 Mon Sep 17 00:00:00 2001 From: Anthony Newnam Date: Thu, 8 Apr 2010 10:28:59 -0500 Subject: Warn users before uploading if there are local changes Change-Id: I231d7b6a3211e9f5ec71a542a0109b0c195d5e40 Signed-off-by: Shawn O. Pearce --- subcmds/upload.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'subcmds/upload.py') diff --git a/subcmds/upload.py b/subcmds/upload.py index ba532461..5a426113 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py @@ -320,6 +320,21 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ people = copy.deepcopy(original_people) self._AppendAutoCcList(branch, people) + # Check if there are local changes that may have been forgotten + if branch.project.HasChanges(): + key = 'review.%s.autoupload' % branch.project.remote.review + answer = branch.project.config.GetBoolean(key) + + # if they want to auto upload, let's not ask because it could be automated + if answer is None: + sys.stdout.write('Uncommitted changes in ' + branch.project.name + ' (did you forget to amend?). Continue uploading? (y/n) ') + a = sys.stdin.readline().strip().lower() + if a not in ('y', 'yes', 't', 'true', 'on'): + print >>sys.stderr, "skipping upload" + branch.uploaded = False + branch.error = 'User aborted' + continue + branch.UploadForReview(people) branch.uploaded = True except UploadError, e: -- cgit v1.2.3-54-g00ecf