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 4388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4399 | 4399 |
4400 # We don't want uncommitted changes mixed up with the patch. | 4400 # We don't want uncommitted changes mixed up with the patch. |
4401 if git_common.is_dirty_git_tree('patch'): | 4401 if git_common.is_dirty_git_tree('patch'): |
4402 return 1 | 4402 return 1 |
4403 | 4403 |
4404 if options.newbranch: | 4404 if options.newbranch: |
4405 if options.force: | 4405 if options.force: |
4406 RunGit(['branch', '-D', options.newbranch], | 4406 RunGit(['branch', '-D', options.newbranch], |
4407 stderr=subprocess2.PIPE, error_ok=True) | 4407 stderr=subprocess2.PIPE, error_ok=True) |
4408 RunGit(['new-branch', options.newbranch]) | 4408 RunGit(['new-branch', options.newbranch]) |
4409 elif not GetCurrentBranch(): | |
4410 DieWithError('A branch is required to apply patch. Hint: use -b option.') | |
michaelpg
2016/08/18 23:03:46
sweet, didn't know about that option
| |
4409 | 4411 |
4410 cl = Changelist(auth_config=auth_config, codereview=options.forced_codereview) | 4412 cl = Changelist(auth_config=auth_config, codereview=options.forced_codereview) |
4411 | 4413 |
4412 if cl.IsGerrit(): | 4414 if cl.IsGerrit(): |
4413 if options.reject: | 4415 if options.reject: |
4414 parser.error('--reject is not supported with Gerrit codereview.') | 4416 parser.error('--reject is not supported with Gerrit codereview.') |
4415 if options.nocommit: | 4417 if options.nocommit: |
4416 parser.error('--nocommit is not supported with Gerrit codereview.') | 4418 parser.error('--nocommit is not supported with Gerrit codereview.') |
4417 if options.directory: | 4419 if options.directory: |
4418 parser.error('--directory is not supported with Gerrit codereview.') | 4420 parser.error('--directory is not supported with Gerrit codereview.') |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5182 if __name__ == '__main__': | 5184 if __name__ == '__main__': |
5183 # These affect sys.stdout so do it outside of main() to simplify mocks in | 5185 # These affect sys.stdout so do it outside of main() to simplify mocks in |
5184 # unit testing. | 5186 # unit testing. |
5185 fix_encoding.fix_encoding() | 5187 fix_encoding.fix_encoding() |
5186 setup_color.init() | 5188 setup_color.init() |
5187 try: | 5189 try: |
5188 sys.exit(main(sys.argv[1:])) | 5190 sys.exit(main(sys.argv[1:])) |
5189 except KeyboardInterrupt: | 5191 except KeyboardInterrupt: |
5190 sys.stderr.write('interrupted\n') | 5192 sys.stderr.write('interrupted\n') |
5191 sys.exit(1) | 5193 sys.exit(1) |
OLD | NEW |