hgext/schemes.py
changeset 46907 ffd3e823a7e5
parent 45942 89a2afe31e82
child 48875 6000f5b25c9b
equal deleted inserted replaced
46906:33524c46a092 46907:ffd3e823a7e5
    50     extensions,
    50     extensions,
    51     hg,
    51     hg,
    52     pycompat,
    52     pycompat,
    53     registrar,
    53     registrar,
    54     templater,
    54     templater,
    55     util,
    55 )
       
    56 from mercurial.utils import (
       
    57     urlutil,
    56 )
    58 )
    57 
    59 
    58 cmdtable = {}
    60 cmdtable = {}
    59 command = registrar.command(cmdtable)
    61 command = registrar.command(cmdtable)
    60 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
    62 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
    84         return hg._peerlookup(url).instance(
    86         return hg._peerlookup(url).instance(
    85             ui, url, create, intents=intents, createopts=createopts
    87             ui, url, create, intents=intents, createopts=createopts
    86         )
    88         )
    87 
    89 
    88     def resolve(self, url):
    90     def resolve(self, url):
    89         # Should this use the util.url class, or is manual parsing better?
    91         # Should this use the urlutil.url class, or is manual parsing better?
    90         try:
    92         try:
    91             url = url.split(b'://', 1)[1]
    93             url = url.split(b'://', 1)[1]
    92         except IndexError:
    94         except IndexError:
    93             raise error.Abort(_(b"no '://' in scheme url '%s'") % url)
    95             raise error.Abort(_(b"no '://' in scheme url '%s'") % url)
    94         parts = url.split(b'/', self.parts)
    96         parts = url.split(b'/', self.parts)
   135                 )
   137                 )
   136                 % (scheme, scheme.upper())
   138                 % (scheme, scheme.upper())
   137             )
   139             )
   138         hg.schemes[scheme] = ShortRepository(url, scheme, t)
   140         hg.schemes[scheme] = ShortRepository(url, scheme, t)
   139 
   141 
   140     extensions.wrapfunction(util, b'hasdriveletter', hasdriveletter)
   142     extensions.wrapfunction(urlutil, b'hasdriveletter', hasdriveletter)
   141 
   143 
   142 
   144 
   143 @command(b'debugexpandscheme', norepo=True)
   145 @command(b'debugexpandscheme', norepo=True)
   144 def expandscheme(ui, url, **opts):
   146 def expandscheme(ui, url, **opts):
   145     """given a repo path, provide the scheme-expanded path"""
   147     """given a repo path, provide the scheme-expanded path"""