| 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 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 self.squash_gerrit_uploads = ( | 770 self.squash_gerrit_uploads = ( |
| 771 RunGit(['config', '--bool', 'gerrit.squash-uploads'], | 771 RunGit(['config', '--bool', 'gerrit.squash-uploads'], |
| 772 error_ok=True).strip() == 'true') | 772 error_ok=True).strip() == 'true') |
| 773 return self.squash_gerrit_uploads | 773 return self.squash_gerrit_uploads |
| 774 | 774 |
| 775 def GetGerritSkipEnsureAuthenticated(self): | 775 def GetGerritSkipEnsureAuthenticated(self): |
| 776 """Return True if EnsureAuthenticated should not be done for Gerrit | 776 """Return True if EnsureAuthenticated should not be done for Gerrit |
| 777 uploads.""" | 777 uploads.""" |
| 778 if self.gerrit_skip_ensure_authenticated is None: | 778 if self.gerrit_skip_ensure_authenticated is None: |
| 779 self.gerrit_skip_ensure_authenticated = ( | 779 self.gerrit_skip_ensure_authenticated = ( |
| 780 RunGit(['config', '--bool', 'gerrit.skip_ensure_authenticated'], | 780 RunGit(['config', '--bool', 'gerrit.skip-ensure-authenticated'], |
| 781 error_ok=True).strip() == 'true') | 781 error_ok=True).strip() == 'true') |
| 782 return self.gerrit_skip_ensure_authenticated | 782 return self.gerrit_skip_ensure_authenticated |
| 783 | 783 |
| 784 def GetGitEditor(self): | 784 def GetGitEditor(self): |
| 785 """Return the editor specified in the git config, or None if none is.""" | 785 """Return the editor specified in the git config, or None if none is.""" |
| 786 if self.git_editor is None: | 786 if self.git_editor is None: |
| 787 self.git_editor = self._GetConfig('core.editor', error_ok=True) | 787 self.git_editor = self._GetConfig('core.editor', error_ok=True) |
| 788 return self.git_editor or None | 788 return self.git_editor or None |
| 789 | 789 |
| 790 def GetLintRegex(self): | 790 def GetLintRegex(self): |
| (...skipping 1934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2725 unset_error_ok=True) | 2725 unset_error_ok=True) |
| 2726 | 2726 |
| 2727 if 'GERRIT_HOST' in keyvals: | 2727 if 'GERRIT_HOST' in keyvals: |
| 2728 RunGit(['config', 'gerrit.host', keyvals['GERRIT_HOST']]) | 2728 RunGit(['config', 'gerrit.host', keyvals['GERRIT_HOST']]) |
| 2729 | 2729 |
| 2730 if 'GERRIT_SQUASH_UPLOADS' in keyvals: | 2730 if 'GERRIT_SQUASH_UPLOADS' in keyvals: |
| 2731 RunGit(['config', 'gerrit.squash-uploads', | 2731 RunGit(['config', 'gerrit.squash-uploads', |
| 2732 keyvals['GERRIT_SQUASH_UPLOADS']]) | 2732 keyvals['GERRIT_SQUASH_UPLOADS']]) |
| 2733 | 2733 |
| 2734 if 'GERRIT_SKIP_ENSURE_AUTHENTICATED' in keyvals: | 2734 if 'GERRIT_SKIP_ENSURE_AUTHENTICATED' in keyvals: |
| 2735 RunGit(['config', 'gerrit.skip_ensure_authenticated', | 2735 RunGit(['config', 'gerrit.skip-ensure-authenticated', |
| 2736 keyvals['GERRIT_SKIP_ENSURE_AUTHENTICATED']]) | 2736 keyvals['GERRIT_SKIP_ENSURE_AUTHENTICATED']]) |
| 2737 | 2737 |
| 2738 if 'PUSH_URL_CONFIG' in keyvals and 'ORIGIN_URL_CONFIG' in keyvals: | 2738 if 'PUSH_URL_CONFIG' in keyvals and 'ORIGIN_URL_CONFIG' in keyvals: |
| 2739 #should be of the form | 2739 #should be of the form |
| 2740 #PUSH_URL_CONFIG: url.ssh://gitrw.chromium.org.pushinsteadof | 2740 #PUSH_URL_CONFIG: url.ssh://gitrw.chromium.org.pushinsteadof |
| 2741 #ORIGIN_URL_CONFIG: http://src.chromium.org/git | 2741 #ORIGIN_URL_CONFIG: http://src.chromium.org/git |
| 2742 RunGit(['config', keyvals['PUSH_URL_CONFIG'], | 2742 RunGit(['config', keyvals['PUSH_URL_CONFIG'], |
| 2743 keyvals['ORIGIN_URL_CONFIG']]) | 2743 keyvals['ORIGIN_URL_CONFIG']]) |
| 2744 | 2744 |
| 2745 | 2745 |
| (...skipping 2079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4825 if __name__ == '__main__': | 4825 if __name__ == '__main__': |
| 4826 # These affect sys.stdout so do it outside of main() to simplify mocks in | 4826 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 4827 # unit testing. | 4827 # unit testing. |
| 4828 fix_encoding.fix_encoding() | 4828 fix_encoding.fix_encoding() |
| 4829 setup_color.init() | 4829 setup_color.init() |
| 4830 try: | 4830 try: |
| 4831 sys.exit(main(sys.argv[1:])) | 4831 sys.exit(main(sys.argv[1:])) |
| 4832 except KeyboardInterrupt: | 4832 except KeyboardInterrupt: |
| 4833 sys.stderr.write('interrupted\n') | 4833 sys.stderr.write('interrupted\n') |
| 4834 sys.exit(1) | 4834 sys.exit(1) |
| OLD | NEW |