| 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 distutils.version import LooseVersion | 10 from distutils.version import LooseVersion |
| (...skipping 2817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2828 SetProperty('cpplint-ignore-regex', 'LINT_IGNORE_REGEX', unset_error_ok=True) | 2828 SetProperty('cpplint-ignore-regex', 'LINT_IGNORE_REGEX', unset_error_ok=True) |
| 2829 SetProperty('project', 'PROJECT', unset_error_ok=True) | 2829 SetProperty('project', 'PROJECT', unset_error_ok=True) |
| 2830 SetProperty('pending-ref-prefix', 'PENDING_REF_PREFIX', unset_error_ok=True) | 2830 SetProperty('pending-ref-prefix', 'PENDING_REF_PREFIX', unset_error_ok=True) |
| 2831 SetProperty('run-post-upload-hook', 'RUN_POST_UPLOAD_HOOK', | 2831 SetProperty('run-post-upload-hook', 'RUN_POST_UPLOAD_HOOK', |
| 2832 unset_error_ok=True) | 2832 unset_error_ok=True) |
| 2833 | 2833 |
| 2834 if 'GERRIT_HOST' in keyvals: | 2834 if 'GERRIT_HOST' in keyvals: |
| 2835 RunGit(['config', 'gerrit.host', keyvals['GERRIT_HOST']]) | 2835 RunGit(['config', 'gerrit.host', keyvals['GERRIT_HOST']]) |
| 2836 | 2836 |
| 2837 if 'GERRIT_SQUASH_UPLOADS' in keyvals: | 2837 if 'GERRIT_SQUASH_UPLOADS' in keyvals: |
| 2838 RunGit(['config', 'gerrit.squash-uploads', | 2838 cur = RunGit(['config', '--bool', 'gerrit.squash-uploads'], error_ok=True) |
| 2839 keyvals['GERRIT_SQUASH_UPLOADS']]) | 2839 if not cur: # Set the value only if it wasn't set by the user manually. |
| 2840 RunGit(['config', 'gerrit.squash-uploads', |
| 2841 keyvals['GERRIT_SQUASH_UPLOADS']]) |
| 2840 | 2842 |
| 2841 if 'GERRIT_SKIP_ENSURE_AUTHENTICATED' in keyvals: | 2843 if 'GERRIT_SKIP_ENSURE_AUTHENTICATED' in keyvals: |
| 2842 RunGit(['config', 'gerrit.skip-ensure-authenticated', | 2844 RunGit(['config', 'gerrit.skip-ensure-authenticated', |
| 2843 keyvals['GERRIT_SKIP_ENSURE_AUTHENTICATED']]) | 2845 keyvals['GERRIT_SKIP_ENSURE_AUTHENTICATED']]) |
| 2844 | 2846 |
| 2845 if 'PUSH_URL_CONFIG' in keyvals and 'ORIGIN_URL_CONFIG' in keyvals: | 2847 if 'PUSH_URL_CONFIG' in keyvals and 'ORIGIN_URL_CONFIG' in keyvals: |
| 2846 #should be of the form | 2848 #should be of the form |
| 2847 #PUSH_URL_CONFIG: url.ssh://gitrw.chromium.org.pushinsteadof | 2849 #PUSH_URL_CONFIG: url.ssh://gitrw.chromium.org.pushinsteadof |
| 2848 #ORIGIN_URL_CONFIG: http://src.chromium.org/git | 2850 #ORIGIN_URL_CONFIG: http://src.chromium.org/git |
| 2849 RunGit(['config', keyvals['PUSH_URL_CONFIG'], | 2851 RunGit(['config', keyvals['PUSH_URL_CONFIG'], |
| (...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5033 if __name__ == '__main__': | 5035 if __name__ == '__main__': |
| 5034 # These affect sys.stdout so do it outside of main() to simplify mocks in | 5036 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 5035 # unit testing. | 5037 # unit testing. |
| 5036 fix_encoding.fix_encoding() | 5038 fix_encoding.fix_encoding() |
| 5037 setup_color.init() | 5039 setup_color.init() |
| 5038 try: | 5040 try: |
| 5039 sys.exit(main(sys.argv[1:])) | 5041 sys.exit(main(sys.argv[1:])) |
| 5040 except KeyboardInterrupt: | 5042 except KeyboardInterrupt: |
| 5041 sys.stderr.write('interrupted\n') | 5043 sys.stderr.write('interrupted\n') |
| 5042 sys.exit(1) | 5044 sys.exit(1) |
| OLD | NEW |