Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(951)

Side by Side Diff: git_cl.py

Issue 2324583002: codereview.settings: add GIT_NUMBER_FOOTER setting. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 self.tree_status_url = None 639 self.tree_status_url = None
640 self.viewvc_url = None 640 self.viewvc_url = None
641 self.updated = False 641 self.updated = False
642 self.is_gerrit = None 642 self.is_gerrit = None
643 self.squash_gerrit_uploads = None 643 self.squash_gerrit_uploads = None
644 self.gerrit_skip_ensure_authenticated = None 644 self.gerrit_skip_ensure_authenticated = None
645 self.git_editor = None 645 self.git_editor = None
646 self.project = None 646 self.project = None
647 self.force_https_commit_url = None 647 self.force_https_commit_url = None
648 self.pending_ref_prefix = None 648 self.pending_ref_prefix = None
649 self.git_number_footer = None
649 650
650 def LazyUpdateIfNeeded(self): 651 def LazyUpdateIfNeeded(self):
651 """Updates the settings from a codereview.settings file, if available.""" 652 """Updates the settings from a codereview.settings file, if available."""
652 if not self.updated: 653 if not self.updated:
653 # The only value that actually changes the behavior is 654 # The only value that actually changes the behavior is
654 # autoupdate = "false". Everything else means "true". 655 # autoupdate = "false". Everything else means "true".
655 autoupdate = RunGit(['config', 'rietveld.autoupdate'], 656 autoupdate = RunGit(['config', 'rietveld.autoupdate'],
656 error_ok=True 657 error_ok=True
657 ).strip().lower() 658 ).strip().lower()
658 659
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 self.force_https_commit_url = self._GetRietveldConfig( 875 self.force_https_commit_url = self._GetRietveldConfig(
875 'force-https-commit-url', error_ok=True) 876 'force-https-commit-url', error_ok=True)
876 return self.force_https_commit_url 877 return self.force_https_commit_url
877 878
878 def GetPendingRefPrefix(self): 879 def GetPendingRefPrefix(self):
879 if not self.pending_ref_prefix: 880 if not self.pending_ref_prefix:
880 self.pending_ref_prefix = self._GetRietveldConfig( 881 self.pending_ref_prefix = self._GetRietveldConfig(
881 'pending-ref-prefix', error_ok=True) 882 'pending-ref-prefix', error_ok=True)
882 return self.pending_ref_prefix 883 return self.pending_ref_prefix
883 884
885 def GetHasGitNumberFooter(self):
886 # TODO(tandrii): this has to be removed after Rietveld is read-only.
tandrii(chromium) 2016/09/09 22:17:03 only while Rietveld Cls can be landed.
887 # see also bugs http://crbug.com/642493 and http://crbug.com/600469.
888 if not self.git_number_footer:
889 self.git_number_footer = self._GetRietveldConfig(
890 'git-number-footer', error_ok=True)
891 return self.git_number_footer
892
884 def _GetRietveldConfig(self, param, **kwargs): 893 def _GetRietveldConfig(self, param, **kwargs):
885 return self._GetConfig('rietveld.' + param, **kwargs) 894 return self._GetConfig('rietveld.' + param, **kwargs)
886 895
887 def _GetBranchConfig(self, branch_name, param, **kwargs): 896 def _GetBranchConfig(self, branch_name, param, **kwargs):
888 return self._GetConfig('branch.' + branch_name + '.' + param, **kwargs) 897 return self._GetConfig('branch.' + branch_name + '.' + param, **kwargs)
889 898
890 def _GetConfig(self, param, **kwargs): 899 def _GetConfig(self, param, **kwargs):
891 self.LazyUpdateIfNeeded() 900 self.LazyUpdateIfNeeded()
892 return RunGit(['config', param], **kwargs).strip() 901 return RunGit(['config', param], **kwargs).strip()
893 902
(...skipping 2052 matching lines...) Expand 10 before | Expand all | Expand 10 after
2946 SetProperty('private', 'PRIVATE', unset_error_ok=True) 2955 SetProperty('private', 'PRIVATE', unset_error_ok=True)
2947 SetProperty('tree-status-url', 'STATUS', unset_error_ok=True) 2956 SetProperty('tree-status-url', 'STATUS', unset_error_ok=True)
2948 SetProperty('viewvc-url', 'VIEW_VC', unset_error_ok=True) 2957 SetProperty('viewvc-url', 'VIEW_VC', unset_error_ok=True)
2949 SetProperty('bug-prefix', 'BUG_PREFIX', unset_error_ok=True) 2958 SetProperty('bug-prefix', 'BUG_PREFIX', unset_error_ok=True)
2950 SetProperty('cpplint-regex', 'LINT_REGEX', unset_error_ok=True) 2959 SetProperty('cpplint-regex', 'LINT_REGEX', unset_error_ok=True)
2951 SetProperty('force-https-commit-url', 'FORCE_HTTPS_COMMIT_URL', 2960 SetProperty('force-https-commit-url', 'FORCE_HTTPS_COMMIT_URL',
2952 unset_error_ok=True) 2961 unset_error_ok=True)
2953 SetProperty('cpplint-ignore-regex', 'LINT_IGNORE_REGEX', unset_error_ok=True) 2962 SetProperty('cpplint-ignore-regex', 'LINT_IGNORE_REGEX', unset_error_ok=True)
2954 SetProperty('project', 'PROJECT', unset_error_ok=True) 2963 SetProperty('project', 'PROJECT', unset_error_ok=True)
2955 SetProperty('pending-ref-prefix', 'PENDING_REF_PREFIX', unset_error_ok=True) 2964 SetProperty('pending-ref-prefix', 'PENDING_REF_PREFIX', unset_error_ok=True)
2965 SetProperty('git-number-footer', 'GIT_NUMBER_FOOTER', unset_error_ok=True)
2956 SetProperty('run-post-upload-hook', 'RUN_POST_UPLOAD_HOOK', 2966 SetProperty('run-post-upload-hook', 'RUN_POST_UPLOAD_HOOK',
2957 unset_error_ok=True) 2967 unset_error_ok=True)
2958 2968
2959 if 'GERRIT_HOST' in keyvals: 2969 if 'GERRIT_HOST' in keyvals:
2960 RunGit(['config', 'gerrit.host', keyvals['GERRIT_HOST']]) 2970 RunGit(['config', 'gerrit.host', keyvals['GERRIT_HOST']])
2961 2971
2962 if 'GERRIT_SQUASH_UPLOADS' in keyvals: 2972 if 'GERRIT_SQUASH_UPLOADS' in keyvals:
2963 RunGit(['config', 'gerrit.squash-uploads', 2973 RunGit(['config', 'gerrit.squash-uploads',
2964 keyvals['GERRIT_SQUASH_UPLOADS']]) 2974 keyvals['GERRIT_SQUASH_UPLOADS']])
2965 2975
(...skipping 2294 matching lines...) Expand 10 before | Expand all | Expand 10 after
5260 if __name__ == '__main__': 5270 if __name__ == '__main__':
5261 # These affect sys.stdout so do it outside of main() to simplify mocks in 5271 # These affect sys.stdout so do it outside of main() to simplify mocks in
5262 # unit testing. 5272 # unit testing.
5263 fix_encoding.fix_encoding() 5273 fix_encoding.fix_encoding()
5264 setup_color.init() 5274 setup_color.init()
5265 try: 5275 try:
5266 sys.exit(main(sys.argv[1:])) 5276 sys.exit(main(sys.argv[1:]))
5267 except KeyboardInterrupt: 5277 except KeyboardInterrupt:
5268 sys.stderr.write('interrupted\n') 5278 sys.stderr.write('interrupted\n')
5269 sys.exit(1) 5279 sys.exit(1)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698