| OLD | NEW | 
|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python | 
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be | 
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. | 
| 5 | 5 | 
| 6 # Copyright (C) 2008 Evan Martin <martine@danga.com> | 6 # Copyright (C) 2008 Evan Martin <martine@danga.com> | 
| 7 | 7 | 
| 8 """A git-command for integrating reviews on Rietveld.""" | 8 """A git-command for integrating reviews on Rietveld.""" | 
| 9 | 9 | 
| 10 import json | 10 import json | 
| (...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1231   upload_args = ['--assume_yes']  # Don't ask about untracked files. | 1231   upload_args = ['--assume_yes']  # Don't ask about untracked files. | 
| 1232   upload_args.extend(['--server', cl.GetRietveldServer()]) | 1232   upload_args.extend(['--server', cl.GetRietveldServer()]) | 
| 1233   if options.emulate_svn_auto_props: | 1233   if options.emulate_svn_auto_props: | 
| 1234     upload_args.append('--emulate_svn_auto_props') | 1234     upload_args.append('--emulate_svn_auto_props') | 
| 1235 | 1235 | 
| 1236   change_desc = None | 1236   change_desc = None | 
| 1237 | 1237 | 
| 1238   if cl.GetIssue(): | 1238   if cl.GetIssue(): | 
| 1239     if options.title: | 1239     if options.title: | 
| 1240       upload_args.extend(['--title', options.title]) | 1240       upload_args.extend(['--title', options.title]) | 
| 1241     elif options.message: | 1241     if options.message: | 
| 1242       # TODO(rogerta): for now, the -m option will also set the --title option | 1242       upload_args.extend(['--message', options.message]) | 
| 1243       # for upload.py.  Soon this will be changed to set the --message option. |  | 
| 1244       # Will wait until people are used to typing -t instead of -m. |  | 
| 1245       upload_args.extend(['--title', options.message]) |  | 
| 1246     upload_args.extend(['--issue', str(cl.GetIssue())]) | 1243     upload_args.extend(['--issue', str(cl.GetIssue())]) | 
| 1247     print ("This branch is associated with issue %s. " | 1244     print ("This branch is associated with issue %s. " | 
| 1248            "Adding patch to that issue." % cl.GetIssue()) | 1245            "Adding patch to that issue." % cl.GetIssue()) | 
| 1249   else: | 1246   else: | 
| 1250     if options.title: | 1247     if options.title: | 
| 1251       upload_args.extend(['--title', options.title]) | 1248       upload_args.extend(['--title', options.title]) | 
| 1252     message = options.title or options.message or CreateDescriptionFromLog(args) | 1249     message = options.title or options.message or CreateDescriptionFromLog(args) | 
| 1253     change_desc = ChangeDescription(message) | 1250     change_desc = ChangeDescription(message) | 
| 1254     if options.reviewers: | 1251     if options.reviewers: | 
| 1255       change_desc.update_reviewers(options.reviewers) | 1252       change_desc.update_reviewers(options.reviewers) | 
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1355                     help='tell the commit queue to commit this patchset') | 1352                     help='tell the commit queue to commit this patchset') | 
| 1356   parser.add_option('--target_branch', | 1353   parser.add_option('--target_branch', | 
| 1357                     help='When uploading to gerrit, remote branch to ' | 1354                     help='When uploading to gerrit, remote branch to ' | 
| 1358                          'use for CL.  Default: master') | 1355                          'use for CL.  Default: master') | 
| 1359   add_git_similarity(parser) | 1356   add_git_similarity(parser) | 
| 1360   (options, args) = parser.parse_args(args) | 1357   (options, args) = parser.parse_args(args) | 
| 1361 | 1358 | 
| 1362   if options.target_branch and not settings.GetIsGerrit(): | 1359   if options.target_branch and not settings.GetIsGerrit(): | 
| 1363     parser.error('Use --target_branch for non gerrit repository.') | 1360     parser.error('Use --target_branch for non gerrit repository.') | 
| 1364 | 1361 | 
| 1365   # Print warning if the user used the -m/--message argument.  This will soon |  | 
| 1366   # change to -t/--title. |  | 
| 1367   if options.message: |  | 
| 1368     print >> sys.stderr, ( |  | 
| 1369         '\nWARNING: Use -t or --title to set the title of the patchset.\n' |  | 
| 1370         'In the near future, -m or --message will send a message instead.\n' |  | 
| 1371         'See http://goo.gl/JGg0Z for details.\n') |  | 
| 1372 |  | 
| 1373   if is_dirty_git_tree('upload'): | 1362   if is_dirty_git_tree('upload'): | 
| 1374     return 1 | 1363     return 1 | 
| 1375 | 1364 | 
| 1376   options.reviewers = cleanup_list(options.reviewers) | 1365   options.reviewers = cleanup_list(options.reviewers) | 
| 1377   options.cc = cleanup_list(options.cc) | 1366   options.cc = cleanup_list(options.cc) | 
| 1378 | 1367 | 
| 1379   cl = Changelist() | 1368   cl = Changelist() | 
| 1380   if args: | 1369   if args: | 
| 1381     # TODO(ukai): is it ok for gerrit case? | 1370     # TODO(ukai): is it ok for gerrit case? | 
| 1382     base_branch = args[0] | 1371     base_branch = args[0] | 
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2091   GenUsage(parser, 'help') | 2080   GenUsage(parser, 'help') | 
| 2092   return CMDhelp(parser, argv) | 2081   return CMDhelp(parser, argv) | 
| 2093 | 2082 | 
| 2094 | 2083 | 
| 2095 if __name__ == '__main__': | 2084 if __name__ == '__main__': | 
| 2096   # These affect sys.stdout so do it outside of main() to simplify mocks in | 2085   # These affect sys.stdout so do it outside of main() to simplify mocks in | 
| 2097   # unit testing. | 2086   # unit testing. | 
| 2098   fix_encoding.fix_encoding() | 2087   fix_encoding.fix_encoding() | 
| 2099   colorama.init() | 2088   colorama.init() | 
| 2100   sys.exit(main(sys.argv[1:])) | 2089   sys.exit(main(sys.argv[1:])) | 
| OLD | NEW | 
|---|