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

Side by Side Diff: git_cl.py

Issue 2277513002: Run auto-spell-checker (codespell) on files in depot_tools. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
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 | « gerrit_util.py ('k') | git_common.py » ('j') | 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 def _git_set_branch_config_value(key, value, branch=None, **kwargs): 195 def _git_set_branch_config_value(key, value, branch=None, **kwargs):
196 """Sets the value or unsets if it's None of a git branch config. 196 """Sets the value or unsets if it's None of a git branch config.
197 197
198 Valid, though not necessarily existing, branch must be provided, 198 Valid, though not necessarily existing, branch must be provided,
199 otherwise currently checked out branch is used. 199 otherwise currently checked out branch is used.
200 """ 200 """
201 if not branch: 201 if not branch:
202 branch = GetCurrentBranch() 202 branch = GetCurrentBranch()
203 assert branch, 'a branch name OR currently checked out branch is required' 203 assert branch, 'a branch name OR currently checked out branch is required'
204 args = ['config'] 204 args = ['config']
205 # Check for boolean first, becuase bool is int, but int is not bool. 205 # Check for boolean first, because bool is int, but int is not bool.
206 if value is None: 206 if value is None:
207 args.append('--unset') 207 args.append('--unset')
208 elif isinstance(value, bool): 208 elif isinstance(value, bool):
209 args.append('--bool') 209 args.append('--bool')
210 value = str(value).lower() 210 value = str(value).lower()
211 else: 211 else:
212 # git config also has --int, but apparently git config suffers from integer 212 # git config also has --int, but apparently git config suffers from integer
213 # overflows (http://crbug.com/640115), so don't use it. 213 # overflows (http://crbug.com/640115), so don't use it.
214 value = str(value) 214 value = str(value)
215 args.append(_git_branch_config_key(branch, key)) 215 args.append(_git_branch_config_key(branch, key))
(...skipping 2180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2396 def _GerritCommitMsgHookCheck(self, offer_removal): 2396 def _GerritCommitMsgHookCheck(self, offer_removal):
2397 hook = os.path.join(settings.GetRoot(), '.git', 'hooks', 'commit-msg') 2397 hook = os.path.join(settings.GetRoot(), '.git', 'hooks', 'commit-msg')
2398 if not os.path.exists(hook): 2398 if not os.path.exists(hook):
2399 return 2399 return
2400 # Crude attempt to distinguish Gerrit Codereview hook from potentially 2400 # Crude attempt to distinguish Gerrit Codereview hook from potentially
2401 # custom developer made one. 2401 # custom developer made one.
2402 data = gclient_utils.FileRead(hook) 2402 data = gclient_utils.FileRead(hook)
2403 if not('From Gerrit Code Review' in data and 'add_ChangeId()' in data): 2403 if not('From Gerrit Code Review' in data and 'add_ChangeId()' in data):
2404 return 2404 return
2405 print('Warning: you have Gerrit commit-msg hook installed.\n' 2405 print('Warning: you have Gerrit commit-msg hook installed.\n'
2406 'It is not neccessary for uploading with git cl in squash mode, ' 2406 'It is not necessary for uploading with git cl in squash mode, '
2407 'and may interfere with it in subtle ways.\n' 2407 'and may interfere with it in subtle ways.\n'
2408 'We recommend you remove the commit-msg hook.') 2408 'We recommend you remove the commit-msg hook.')
2409 if offer_removal: 2409 if offer_removal:
2410 reply = ask_for_data('Do you want to remove it now? [Yes/No]') 2410 reply = ask_for_data('Do you want to remove it now? [Yes/No]')
2411 if reply.lower().startswith('y'): 2411 if reply.lower().startswith('y'):
2412 gclient_utils.rm_file_or_tree(hook) 2412 gclient_utils.rm_file_or_tree(hook)
2413 print('Gerrit commit-msg hook removed.') 2413 print('Gerrit commit-msg hook removed.')
2414 else: 2414 else:
2415 print('OK, will keep Gerrit commit-msg hook in place.') 2415 print('OK, will keep Gerrit commit-msg hook in place.')
2416 2416
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
3107 3107
3108 If fine_grained is true, this will fetch CL statuses from the server. 3108 If fine_grained is true, this will fetch CL statuses from the server.
3109 Otherwise, simply indicate if there's a matching url for the given branches. 3109 Otherwise, simply indicate if there's a matching url for the given branches.
3110 3110
3111 If max_processes is specified, it is used as the maximum number of processes 3111 If max_processes is specified, it is used as the maximum number of processes
3112 to spawn to fetch CL status from the server. Otherwise 1 process per branch is 3112 to spawn to fetch CL status from the server. Otherwise 1 process per branch is
3113 spawned. 3113 spawned.
3114 3114
3115 See GetStatus() for a list of possible statuses. 3115 See GetStatus() for a list of possible statuses.
3116 """ 3116 """
3117 # Silence upload.py otherwise it becomes unwieldly. 3117 # Silence upload.py otherwise it becomes unwieldy.
3118 upload.verbosity = 0 3118 upload.verbosity = 0
3119 3119
3120 if fine_grained: 3120 if fine_grained:
3121 # Process one branch synchronously to work through authentication, then 3121 # Process one branch synchronously to work through authentication, then
3122 # spawn processes to process all the other branches in parallel. 3122 # spawn processes to process all the other branches in parallel.
3123 if changes: 3123 if changes:
3124 def fetch(cl): 3124 def fetch(cl):
3125 try: 3125 try:
3126 return (cl, cl.GetStatus()) 3126 return (cl, cl.GetStatus())
3127 except: 3127 except:
(...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after
5218 if __name__ == '__main__': 5218 if __name__ == '__main__':
5219 # These affect sys.stdout so do it outside of main() to simplify mocks in 5219 # These affect sys.stdout so do it outside of main() to simplify mocks in
5220 # unit testing. 5220 # unit testing.
5221 fix_encoding.fix_encoding() 5221 fix_encoding.fix_encoding()
5222 setup_color.init() 5222 setup_color.init()
5223 try: 5223 try:
5224 sys.exit(main(sys.argv[1:])) 5224 sys.exit(main(sys.argv[1:]))
5225 except KeyboardInterrupt: 5225 except KeyboardInterrupt:
5226 sys.stderr.write('interrupted\n') 5226 sys.stderr.write('interrupted\n')
5227 sys.exit(1) 5227 sys.exit(1)
OLDNEW
« no previous file with comments | « gerrit_util.py ('k') | git_common.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698