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

Side by Side Diff: tools/check_git_config.py

Issue 1301453003: Fix encoding issue in check_git_config (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 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 """Script that attempts to push to a special git repository to verify that git 6 """Script that attempts to push to a special git repository to verify that git
7 credentials are configured correctly. It also verifies that gclient solution is 7 credentials are configured correctly. It also verifies that gclient solution is
8 configured to use git checkout. 8 configured to use git checkout.
9 9
10 It will be added as gclient hook shortly before Chromium switches to git and 10 It will be added as gclient hook shortly before Chromium switches to git and
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 def read_git_config(prop): 105 def read_git_config(prop):
106 """Reads git config property of src.git repo. 106 """Reads git config property of src.git repo.
107 107
108 Returns empty string in case of errors. 108 Returns empty string in case of errors.
109 """ 109 """
110 try: 110 try:
111 proc = subprocess.Popen( 111 proc = subprocess.Popen(
112 [GIT_EXE, 'config', prop], stdout=subprocess.PIPE, cwd=REPO_ROOT) 112 [GIT_EXE, 'config', prop], stdout=subprocess.PIPE, cwd=REPO_ROOT)
113 out, _ = proc.communicate() 113 out, _ = proc.communicate()
114 return out.strip() 114 return out.strip().decode('utf-8')
115 except OSError as exc: 115 except OSError as exc:
116 if exc.errno != errno.ENOENT: 116 if exc.errno != errno.ENOENT:
117 logging.exception('Unexpected error when calling git') 117 logging.exception('Unexpected error when calling git')
118 return '' 118 return ''
119 119
120 120
121 def read_netrc_user(netrc_obj, host): 121 def read_netrc_user(netrc_obj, host):
122 """Reads 'user' field of a host entry in netrc. 122 """Reads 'user' field of a host entry in netrc.
123 123
124 Returns empty string if netrc is missing, or host is not there. 124 Returns empty string if netrc is missing, or host is not there.
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 write_last_configuration(config) 531 write_last_configuration(config)
532 else: 532 else:
533 logging.warning('Check failed and will be retried on the next run') 533 logging.warning('Check failed and will be retried on the next run')
534 except Exception: 534 except Exception:
535 logging.exception('Unexpected exception when performing git access check') 535 logging.exception('Unexpected exception when performing git access check')
536 return 0 536 return 0
537 537
538 538
539 if __name__ == '__main__': 539 if __name__ == '__main__':
540 sys.exit(main(sys.argv[1:])) 540 sys.exit(main(sys.argv[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