Mercurial > hg
comparison hgext/acl.py @ 36412:03eff66adb3b
acl: replace bare getpass.getuser() by platform function
Follows up dbadf28d4db0. bytestr() shouldn't be applied here because getuser()
isn't guaranteed to be all in ASCII.
This change means GetUserNameA() is used on Windows, but that's probably
better than trying to get the current user name in UNIX way.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 25 Feb 2018 11:13:01 +0900 |
parents | 2827fa74adbc |
children | a8a902d7176e |
comparison
equal
deleted
inserted
replaced
36411:38f480502043 | 36412:03eff66adb3b |
---|---|
191 | 191 |
192 ''' | 192 ''' |
193 | 193 |
194 from __future__ import absolute_import | 194 from __future__ import absolute_import |
195 | 195 |
196 import getpass | |
197 | |
198 from mercurial.i18n import _ | 196 from mercurial.i18n import _ |
199 from mercurial import ( | 197 from mercurial import ( |
200 error, | 198 error, |
201 extensions, | 199 extensions, |
202 match, | 200 match, |
203 pycompat, | |
204 registrar, | 201 registrar, |
205 util, | 202 util, |
206 ) | 203 ) |
207 | 204 |
208 urlreq = util.urlreq | 205 urlreq = util.urlreq |
339 url = kwargs[r'url'].split(':') | 336 url = kwargs[r'url'].split(':') |
340 if url[0] == 'remote' and url[1].startswith('http'): | 337 if url[0] == 'remote' and url[1].startswith('http'): |
341 user = urlreq.unquote(url[3]) | 338 user = urlreq.unquote(url[3]) |
342 | 339 |
343 if user is None: | 340 if user is None: |
344 user = pycompat.bytestr(getpass.getuser()) | 341 user = util.getuser() |
345 | 342 |
346 ui.debug('acl: checking access for user "%s"\n' % user) | 343 ui.debug('acl: checking access for user "%s"\n' % user) |
347 | 344 |
348 # deprecated config: acl.config | 345 # deprecated config: acl.config |
349 cfg = ui.config('acl', 'config') | 346 cfg = ui.config('acl', 'config') |