Chromium Code Reviews| 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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 960 """upload the patch to rietveld.""" | 960 """upload the patch to rietveld.""" |
| 961 upload_args = ['--assume_yes'] # Don't ask about untracked files. | 961 upload_args = ['--assume_yes'] # Don't ask about untracked files. |
| 962 upload_args.extend(['--server', cl.GetRietveldServer()]) | 962 upload_args.extend(['--server', cl.GetRietveldServer()]) |
| 963 if options.emulate_svn_auto_props: | 963 if options.emulate_svn_auto_props: |
| 964 upload_args.append('--emulate_svn_auto_props') | 964 upload_args.append('--emulate_svn_auto_props') |
| 965 | 965 |
| 966 change_desc = None | 966 change_desc = None |
| 967 | 967 |
| 968 if cl.GetIssue(): | 968 if cl.GetIssue(): |
| 969 if options.message: | 969 if options.message: |
| 970 upload_args.extend(['--message', options.message]) | 970 upload_args.extend(['--title', options.message]) |
| 971 upload_args.extend(['--issue', cl.GetIssue()]) | 971 upload_args.extend(['--issue', cl.GetIssue()]) |
| 972 print ("This branch is associated with issue %s. " | 972 print ("This branch is associated with issue %s. " |
| 973 "Adding patch to that issue." % cl.GetIssue()) | 973 "Adding patch to that issue." % cl.GetIssue()) |
| 974 else: | 974 else: |
| 975 message = options.message or CreateDescriptionFromLog(args) | 975 message = options.message or CreateDescriptionFromLog(args) |
| 976 change_desc = ChangeDescription(message, options.reviewers) | 976 change_desc = ChangeDescription(message, options.reviewers) |
| 977 if not options.force: | 977 if not options.force: |
| 978 change_desc.Prompt() | 978 change_desc.Prompt() |
| 979 change_desc.ParseDescription() | 979 change_desc.ParseDescription() |
| 980 | 980 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1036 return 0 | 1036 return 0 |
| 1037 | 1037 |
| 1038 | 1038 |
| 1039 @usage('[args to "git diff"]') | 1039 @usage('[args to "git diff"]') |
| 1040 def CMDupload(parser, args): | 1040 def CMDupload(parser, args): |
| 1041 """upload the current changelist to codereview""" | 1041 """upload the current changelist to codereview""" |
| 1042 parser.add_option('--bypass-hooks', action='store_true', dest='bypass_hooks', | 1042 parser.add_option('--bypass-hooks', action='store_true', dest='bypass_hooks', |
| 1043 help='bypass upload presubmit hook') | 1043 help='bypass upload presubmit hook') |
| 1044 parser.add_option('-f', action='store_true', dest='force', | 1044 parser.add_option('-f', action='store_true', dest='force', |
| 1045 help="force yes to questions (don't prompt)") | 1045 help="force yes to questions (don't prompt)") |
| 1046 parser.add_option('-m', dest='message', help='message for patch') | 1046 parser.add_option('-m', dest='message', help='message for patch') |
|
M-A Ruel
2012/05/14 16:13:24
You forgot to add -t :)
Roger Tawa OOO till Jul 10th
2012/05/14 18:17:02
Duh. This file was far from done before sending f
| |
| 1047 parser.add_option('-r', '--reviewers', | 1047 parser.add_option('-r', '--reviewers', |
| 1048 help='reviewer email addresses') | 1048 help='reviewer email addresses') |
| 1049 parser.add_option('--cc', | 1049 parser.add_option('--cc', |
| 1050 help='cc email addresses') | 1050 help='cc email addresses') |
| 1051 parser.add_option('--send-mail', action='store_true', | 1051 parser.add_option('--send-mail', action='store_true', |
| 1052 help='send email to reviewer immediately') | 1052 help='send email to reviewer immediately') |
| 1053 parser.add_option("--emulate_svn_auto_props", action="store_true", | 1053 parser.add_option("--emulate_svn_auto_props", action="store_true", |
| 1054 dest="emulate_svn_auto_props", | 1054 dest="emulate_svn_auto_props", |
| 1055 help="Emulate Subversion's auto properties feature.") | 1055 help="Emulate Subversion's auto properties feature.") |
| 1056 parser.add_option("--desc_from_logs", action="store_true", | 1056 parser.add_option("--desc_from_logs", action="store_true", |
| 1057 dest="from_logs", | 1057 dest="from_logs", |
| 1058 help="""Squashes git commit logs into change description and | 1058 help="""Squashes git commit logs into change description and |
| 1059 uses message as subject""") | 1059 uses message as subject""") |
| 1060 parser.add_option('-c', '--use-commit-queue', action='store_true', | 1060 parser.add_option('-c', '--use-commit-queue', action='store_true', |
| 1061 help='tell the commit queue to commit this patchset') | 1061 help='tell the commit queue to commit this patchset') |
| 1062 if settings.GetIsGerrit(): | 1062 if settings.GetIsGerrit(): |
| 1063 parser.add_option('--target_branch', dest='target_branch', default='master', | 1063 parser.add_option('--target_branch', dest='target_branch', default='master', |
| 1064 help='target branch to upload') | 1064 help='target branch to upload') |
| 1065 (options, args) = parser.parse_args(args) | 1065 (options, args) = parser.parse_args(args) |
| 1066 | 1066 |
| 1067 # Print warning if the user used the -m/--message argument. This will soon | |
| 1068 # change to -t/--title. | |
| 1069 print >> sys.stderr, ( | |
| 1070 '\nWARNING: Use -t or --title to set the title of the patchset.\n' + | |
| 1071 'In the near future, -m or --message will send a message instead.\n' + | |
| 1072 'See http://groups.google.com/a/chromium.org/group/chromium-dev/browse_thr ead/thread/d8422e01be3ddc51# for details.\n') | |
| 1073 | |
| 1067 # Make sure index is up-to-date before running diff-index. | 1074 # Make sure index is up-to-date before running diff-index. |
| 1068 RunGit(['update-index', '--refresh', '-q'], error_ok=True) | 1075 RunGit(['update-index', '--refresh', '-q'], error_ok=True) |
| 1069 if RunGit(['diff-index', 'HEAD']): | 1076 if RunGit(['diff-index', 'HEAD']): |
| 1070 print 'Cannot upload with a dirty tree. You must commit locally first.' | 1077 print 'Cannot upload with a dirty tree. You must commit locally first.' |
| 1071 return 1 | 1078 return 1 |
| 1072 | 1079 |
| 1073 cl = Changelist() | 1080 cl = Changelist() |
| 1074 if args: | 1081 if args: |
| 1075 # TODO(ukai): is it ok for gerrit case? | 1082 # TODO(ukai): is it ok for gerrit case? |
| 1076 base_branch = args[0] | 1083 base_branch = args[0] |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1535 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 1542 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
| 1536 | 1543 |
| 1537 # Not a known command. Default to help. | 1544 # Not a known command. Default to help. |
| 1538 GenUsage(parser, 'help') | 1545 GenUsage(parser, 'help') |
| 1539 return CMDhelp(parser, argv) | 1546 return CMDhelp(parser, argv) |
| 1540 | 1547 |
| 1541 | 1548 |
| 1542 if __name__ == '__main__': | 1549 if __name__ == '__main__': |
| 1543 fix_encoding.fix_encoding() | 1550 fix_encoding.fix_encoding() |
| 1544 sys.exit(main(sys.argv[1:])) | 1551 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |