| 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 and Gerrit.""" | 8 """A git-command for integrating reviews on Rietveld and Gerrit.""" |
| 9 | 9 |
| 10 from __future__ import print_function | 10 from __future__ import print_function |
| (...skipping 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2625 if cc: | 2625 if cc: |
| 2626 refspec_opts.extend('cc=' + email.strip() for email in cc) | 2626 refspec_opts.extend('cc=' + email.strip() for email in cc) |
| 2627 | 2627 |
| 2628 reviewers = change_desc.get_reviewers() | 2628 reviewers = change_desc.get_reviewers() |
| 2629 if reviewers: | 2629 if reviewers: |
| 2630 refspec_opts.extend('r=' + email.strip() for email in reviewers) | 2630 refspec_opts.extend('r=' + email.strip() for email in reviewers) |
| 2631 | 2631 |
| 2632 if options.private: | 2632 if options.private: |
| 2633 refspec_opts.append('draft') | 2633 refspec_opts.append('draft') |
| 2634 | 2634 |
| 2635 if options.topic: |
| 2636 # Documentation on Gerrit topics is here: |
| 2637 # https://gerrit-review.googlesource.com/Documentation/user-upload.html#to
pic |
| 2638 refspec_opts.append('topic=%s' % options.topic) |
| 2639 |
| 2635 refspec_suffix = '' | 2640 refspec_suffix = '' |
| 2636 if refspec_opts: | 2641 if refspec_opts: |
| 2637 refspec_suffix = '%' + ','.join(refspec_opts) | 2642 refspec_suffix = '%' + ','.join(refspec_opts) |
| 2638 assert ' ' not in refspec_suffix, ( | 2643 assert ' ' not in refspec_suffix, ( |
| 2639 'spaces not allowed in refspec: "%s"' % refspec_suffix) | 2644 'spaces not allowed in refspec: "%s"' % refspec_suffix) |
| 2640 refspec = '%s:refs/for/%s%s' % (ref_to_push, branch, refspec_suffix) | 2645 refspec = '%s:refs/for/%s%s' % (ref_to_push, branch, refspec_suffix) |
| 2641 | 2646 |
| 2642 push_stdout = gclient_utils.CheckCallAndFilter( | 2647 push_stdout = gclient_utils.CheckCallAndFilter( |
| 2643 ['git', 'push', gerrit_remote, refspec], | 2648 ['git', 'push', gerrit_remote, refspec], |
| 2644 print_stdout=True, | 2649 print_stdout=True, |
| (...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3925 parser.add_option('--target_branch', | 3930 parser.add_option('--target_branch', |
| 3926 '--target-branch', | 3931 '--target-branch', |
| 3927 metavar='TARGET', | 3932 metavar='TARGET', |
| 3928 help='Apply CL to remote ref TARGET. ' + | 3933 help='Apply CL to remote ref TARGET. ' + |
| 3929 'Default: remote branch head, or master') | 3934 'Default: remote branch head, or master') |
| 3930 parser.add_option('--squash', action='store_true', | 3935 parser.add_option('--squash', action='store_true', |
| 3931 help='Squash multiple commits into one (Gerrit only)') | 3936 help='Squash multiple commits into one (Gerrit only)') |
| 3932 parser.add_option('--no-squash', action='store_true', | 3937 parser.add_option('--no-squash', action='store_true', |
| 3933 help='Don\'t squash multiple commits into one ' + | 3938 help='Don\'t squash multiple commits into one ' + |
| 3934 '(Gerrit only)') | 3939 '(Gerrit only)') |
| 3940 parser.add_option('--topic', default=None, |
| 3941 help='Topic to specify when uploading (Gerrit only)') |
| 3935 parser.add_option('--email', default=None, | 3942 parser.add_option('--email', default=None, |
| 3936 help='email address to use to connect to Rietveld') | 3943 help='email address to use to connect to Rietveld') |
| 3937 parser.add_option('--tbr-owners', dest='tbr_owners', action='store_true', | 3944 parser.add_option('--tbr-owners', dest='tbr_owners', action='store_true', |
| 3938 help='add a set of OWNERS to TBR') | 3945 help='add a set of OWNERS to TBR') |
| 3939 parser.add_option('-d', '--cq-dry-run', dest='cq_dry_run', | 3946 parser.add_option('-d', '--cq-dry-run', dest='cq_dry_run', |
| 3940 action='store_true', | 3947 action='store_true', |
| 3941 help='Send the patchset to do a CQ dry run right after ' | 3948 help='Send the patchset to do a CQ dry run right after ' |
| 3942 'upload.') | 3949 'upload.') |
| 3943 parser.add_option('--dependencies', action='store_true', | 3950 parser.add_option('--dependencies', action='store_true', |
| 3944 help='Uploads CLs of all the local branches that depend on ' | 3951 help='Uploads CLs of all the local branches that depend on ' |
| (...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5289 if __name__ == '__main__': | 5296 if __name__ == '__main__': |
| 5290 # These affect sys.stdout so do it outside of main() to simplify mocks in | 5297 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 5291 # unit testing. | 5298 # unit testing. |
| 5292 fix_encoding.fix_encoding() | 5299 fix_encoding.fix_encoding() |
| 5293 setup_color.init() | 5300 setup_color.init() |
| 5294 try: | 5301 try: |
| 5295 sys.exit(main(sys.argv[1:])) | 5302 sys.exit(main(sys.argv[1:])) |
| 5296 except KeyboardInterrupt: | 5303 except KeyboardInterrupt: |
| 5297 sys.stderr.write('interrupted\n') | 5304 sys.stderr.write('interrupted\n') |
| 5298 sys.exit(1) | 5305 sys.exit(1) |
| OLD | NEW |