When converting -m/--message to -t, make sure to handle the case --message=foo
correctly.  Also fix git_cl.py.

BUG=None
TEST=Make sure that the -m command line option to gcl upload/git cl upload
does not add a new message to the rietveld issue.  The string associated to the
--message argument should only be used as the patchset title.

Review URL: https://chromiumcodereview.appspot.com/10384150

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@136922 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_cl.py b/git_cl.py
index a111eac..2c63d73 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -966,12 +966,19 @@
   change_desc = None
 
   if cl.GetIssue():
-    if options.message:
-      upload_args.extend(['--message', options.message])
+    if options.title:
+      upload_args.extend(['--title', options.title])
+    elif options.message:
+      # TODO(rogerta): for now, the -m option will also set the --title option
+      # for upload.py.  Soon this will be changed to set the --message option.
+      # Will wait until people are used to typing -t instead of -m.
+      upload_args.extend(['--title', options.message])
     upload_args.extend(['--issue', cl.GetIssue()])
     print ("This branch is associated with issue %s. "
            "Adding patch to that issue." % cl.GetIssue())
   else:
+    if options.title:
+      upload_args.extend(['--title', options.title])
     message = options.message or CreateDescriptionFromLog(args)
     change_desc = ChangeDescription(message, options.reviewers)
     if not options.force:
@@ -1043,7 +1050,8 @@
                     help='bypass upload presubmit hook')
   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 patch')
+  parser.add_option('-m', dest='message', help='message for patchset')
+  parser.add_option('-t', dest='title', help='title for patchset')
   parser.add_option('-r', '--reviewers',
                     help='reviewer email addresses')
   parser.add_option('--cc',
@@ -1064,6 +1072,14 @@
                       help='target branch to upload')
   (options, args) = parser.parse_args(args)
 
+  # Print warning if the user used the -m/--message argument.  This will soon
+  # change to -t/--title.
+  if options.message:
+    print >> sys.stderr, (
+        '\nWARNING: Use -t or --title to set the title of the patchset.\n'
+        'In the near future, -m or --message will send a message instead.\n'
+        'See http://goo.gl/JGg0Z for details.\n')
+    
   # Make sure index is up-to-date before running diff-index.
   RunGit(['update-index', '--refresh', '-q'], error_ok=True)
   if RunGit(['diff-index', 'HEAD']):