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 2602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2613 if options.cc: | 2613 if options.cc: |
2614 cc.extend(options.cc) | 2614 cc.extend(options.cc) |
2615 cc = filter(None, cc) | 2615 cc = filter(None, cc) |
2616 if cc: | 2616 if cc: |
2617 refspec_opts.extend('cc=' + email.strip() for email in cc) | 2617 refspec_opts.extend('cc=' + email.strip() for email in cc) |
2618 | 2618 |
2619 reviewers = change_desc.get_reviewers() | 2619 reviewers = change_desc.get_reviewers() |
2620 if reviewers: | 2620 if reviewers: |
2621 refspec_opts.extend('r=' + email.strip() for email in reviewers) | 2621 refspec_opts.extend('r=' + email.strip() for email in reviewers) |
2622 | 2622 |
| 2623 if options.private: |
| 2624 refspec_opts.append('draft') |
| 2625 |
2623 refspec_suffix = '' | 2626 refspec_suffix = '' |
2624 if refspec_opts: | 2627 if refspec_opts: |
2625 refspec_suffix = '%' + ','.join(refspec_opts) | 2628 refspec_suffix = '%' + ','.join(refspec_opts) |
2626 assert ' ' not in refspec_suffix, ( | 2629 assert ' ' not in refspec_suffix, ( |
2627 'spaces not allowed in refspec: "%s"' % refspec_suffix) | 2630 'spaces not allowed in refspec: "%s"' % refspec_suffix) |
2628 refspec = '%s:refs/for/%s%s' % (ref_to_push, branch, refspec_suffix) | 2631 refspec = '%s:refs/for/%s%s' % (ref_to_push, branch, refspec_suffix) |
2629 | 2632 |
2630 push_stdout = gclient_utils.CheckCallAndFilter( | 2633 push_stdout = gclient_utils.CheckCallAndFilter( |
2631 ['git', 'push', gerrit_remote, refspec], | 2634 ['git', 'push', gerrit_remote, refspec], |
2632 print_stdout=True, | 2635 print_stdout=True, |
(...skipping 2641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5274 if __name__ == '__main__': | 5277 if __name__ == '__main__': |
5275 # These affect sys.stdout so do it outside of main() to simplify mocks in | 5278 # These affect sys.stdout so do it outside of main() to simplify mocks in |
5276 # unit testing. | 5279 # unit testing. |
5277 fix_encoding.fix_encoding() | 5280 fix_encoding.fix_encoding() |
5278 setup_color.init() | 5281 setup_color.init() |
5279 try: | 5282 try: |
5280 sys.exit(main(sys.argv[1:])) | 5283 sys.exit(main(sys.argv[1:])) |
5281 except KeyboardInterrupt: | 5284 except KeyboardInterrupt: |
5282 sys.stderr.write('interrupted\n') | 5285 sys.stderr.write('interrupted\n') |
5283 sys.exit(1) | 5286 sys.exit(1) |
OLD | NEW |