| 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 3046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3057 """Parse a codereview.settings file and updates hooks.""" | 3057 """Parse a codereview.settings file and updates hooks.""" |
| 3058 keyvals = gclient_utils.ParseCodereviewSettingsContent(fileobj.read()) | 3058 keyvals = gclient_utils.ParseCodereviewSettingsContent(fileobj.read()) |
| 3059 | 3059 |
| 3060 def SetProperty(name, setting, unset_error_ok=False): | 3060 def SetProperty(name, setting, unset_error_ok=False): |
| 3061 fullname = 'rietveld.' + name | 3061 fullname = 'rietveld.' + name |
| 3062 if setting in keyvals: | 3062 if setting in keyvals: |
| 3063 RunGit(['config', fullname, keyvals[setting]]) | 3063 RunGit(['config', fullname, keyvals[setting]]) |
| 3064 else: | 3064 else: |
| 3065 RunGit(['config', '--unset-all', fullname], error_ok=unset_error_ok) | 3065 RunGit(['config', '--unset-all', fullname], error_ok=unset_error_ok) |
| 3066 | 3066 |
| 3067 SetProperty('server', 'CODE_REVIEW_SERVER') | 3067 if not keyvals.get('GERRIT_HOST', False): |
| 3068 SetProperty('server', 'CODE_REVIEW_SERVER') |
| 3068 # Only server setting is required. Other settings can be absent. | 3069 # Only server setting is required. Other settings can be absent. |
| 3069 # In that case, we ignore errors raised during option deletion attempt. | 3070 # In that case, we ignore errors raised during option deletion attempt. |
| 3070 SetProperty('cc', 'CC_LIST', unset_error_ok=True) | 3071 SetProperty('cc', 'CC_LIST', unset_error_ok=True) |
| 3071 SetProperty('private', 'PRIVATE', unset_error_ok=True) | 3072 SetProperty('private', 'PRIVATE', unset_error_ok=True) |
| 3072 SetProperty('tree-status-url', 'STATUS', unset_error_ok=True) | 3073 SetProperty('tree-status-url', 'STATUS', unset_error_ok=True) |
| 3073 SetProperty('viewvc-url', 'VIEW_VC', unset_error_ok=True) | 3074 SetProperty('viewvc-url', 'VIEW_VC', unset_error_ok=True) |
| 3074 SetProperty('bug-prefix', 'BUG_PREFIX', unset_error_ok=True) | 3075 SetProperty('bug-prefix', 'BUG_PREFIX', unset_error_ok=True) |
| 3075 SetProperty('cpplint-regex', 'LINT_REGEX', unset_error_ok=True) | 3076 SetProperty('cpplint-regex', 'LINT_REGEX', unset_error_ok=True) |
| 3076 SetProperty('force-https-commit-url', 'FORCE_HTTPS_COMMIT_URL', | 3077 SetProperty('force-https-commit-url', 'FORCE_HTTPS_COMMIT_URL', |
| 3077 unset_error_ok=True) | 3078 unset_error_ok=True) |
| (...skipping 2294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5372 if __name__ == '__main__': | 5373 if __name__ == '__main__': |
| 5373 # These affect sys.stdout so do it outside of main() to simplify mocks in | 5374 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 5374 # unit testing. | 5375 # unit testing. |
| 5375 fix_encoding.fix_encoding() | 5376 fix_encoding.fix_encoding() |
| 5376 setup_color.init() | 5377 setup_color.init() |
| 5377 try: | 5378 try: |
| 5378 sys.exit(main(sys.argv[1:])) | 5379 sys.exit(main(sys.argv[1:])) |
| 5379 except KeyboardInterrupt: | 5380 except KeyboardInterrupt: |
| 5380 sys.stderr.write('interrupted\n') | 5381 sys.stderr.write('interrupted\n') |
| 5381 sys.exit(1) | 5382 sys.exit(1) |
| OLD | NEW |