hgext/acl.py
changeset 28883 032c4c2f802a
parent 28089 a1163ee26e4a
child 29841 d5883fd055c6
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)