Commit 962f9469 authored by andybons@chromium.org's avatar andybons@chromium.org

Abort if a patch set title is provided for a Gerrit server

Gerrit doesn’t support patch titles.

BUG=579178

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@298573 0039d316-1c4b-4281-b951-d872f2087c98
parent 0097973a
......@@ -1627,8 +1627,10 @@ def upload_branch_deps(cl, args):
'"git cl upload".')
ask_for_data('[Press enter to continue or ctrl-C to quit]')
# Add a default patchset title to all upload calls.
args.extend(['-t', 'Updated patchset dependency'])
# Add a default patchset title to all upload calls in Rietveld.
if not settings.GetIsGerrit():
args.extend(['-t', 'Updated patchset dependency'])
# Record all dependents that failed to upload.
failures = {}
# Go through all dependents, checkout the branch and upload.
......@@ -2010,7 +2012,11 @@ def GerritUpload(options, args, cl, change):
change_desc = ChangeDescription(
options.message or CreateDescriptionFromLog(args))
if not change_desc.description:
print "Description is empty; aborting."
print "\nDescription is empty. Aborting..."
return 1
if options.title:
print "\nPatch titles (-t) are not supported in Gerrit. Aborting..."
return 1
if options.squash:
......@@ -2351,7 +2357,8 @@ def CMDupload(parser, args):
parser.add_option('-f', action='store_true', dest='force',
help="force yes to questions (don't prompt)")
parser.add_option('-m', dest='message', help='message for patchset')
parser.add_option('-t', dest='title', help='title for patchset')
parser.add_option('-t', dest='title',
help='title for patchset (Rietveld only)')
parser.add_option('-r', '--reviewers',
action='append', default=[],
help='reviewer email addresses')
......
......@@ -717,6 +717,9 @@ class TestGitCl(TestCase):
return '\n'.join(branch_deps)
self.mock(git_cl, 'RunGit', mock_run_git)
git_cl.settings = git_cl.Settings()
self.mock(git_cl.settings, 'GetIsGerrit', lambda: False)
class RecordCalls:
times_called = 0
record_calls = RecordCalls()
......
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