comparison hgext/acl.py @ 28883:032c4c2f802a

pycompat: switch to util.urlreq/util.urlerr for py3 compat
author timeless <timeless@mozdev.org>
date Wed, 06 Apr 2016 23:22:12 +0000
parents a1163ee26e4a
children d5883fd055c6
comparison
equal deleted inserted replaced
28882:800ec7c048b0 28883:032c4c2f802a
192 ''' 192 '''
193 193
194 from __future__ import absolute_import 194 from __future__ import absolute_import
195 195
196 import getpass 196 import getpass
197 import urllib
198 197
199 from mercurial.i18n import _ 198 from mercurial.i18n import _
200 from mercurial import ( 199 from mercurial import (
201 error, 200 error,
202 match, 201 match,
203 util, 202 util,
204 ) 203 )
204
205 urlreq = util.urlreq
205 206
206 # Note for extension authors: ONLY specify testedwith = 'internal' for 207 # Note for extension authors: ONLY specify testedwith = 'internal' for
207 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should 208 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
208 # be specifying the version(s) of Mercurial they are tested with, or 209 # be specifying the version(s) of Mercurial they are tested with, or
209 # leave the attribute unspecified. 210 # leave the attribute unspecified.
285 286
286 user = None 287 user = None
287 if source == 'serve' and 'url' in kwargs: 288 if source == 'serve' and 'url' in kwargs:
288 url = kwargs['url'].split(':') 289 url = kwargs['url'].split(':')
289 if url[0] == 'remote' and url[1].startswith('http'): 290 if url[0] == 'remote' and url[1].startswith('http'):
290 user = urllib.unquote(url[3]) 291 user = urlreq.unquote(url[3])
291 292
292 if user is None: 293 if user is None:
293 user = getpass.getuser() 294 user = getpass.getuser()
294 295
295 ui.debug('acl: checking access for user "%s"\n' % user) 296 ui.debug('acl: checking access for user "%s"\n' % user)