hgext/schemes.py
changeset 27982 bf1d5c223ac0
parent 27981 d630eac3a5db
child 28379 27a9032374a7
equal deleted inserted replaced
27981:d630eac3a5db 27982:bf1d5c223ac0
    39 You can override a predefined scheme by defining a new scheme with the
    39 You can override a predefined scheme by defining a new scheme with the
    40 same name.
    40 same name.
    41 """
    41 """
    42 
    42 
    43 import os, re
    43 import os, re
    44 from mercurial import extensions, hg, templater, util, error
    44 from mercurial import extensions, hg, templater, util, error, cmdutil
    45 from mercurial.i18n import _
    45 from mercurial.i18n import _
    46 
    46 
       
    47 cmdtable = {}
       
    48 command = cmdutil.command(cmdtable)
    47 # Note for extension authors: ONLY specify testedwith = 'internal' for
    49 # Note for extension authors: ONLY specify testedwith = 'internal' for
    48 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
    50 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
    49 # be specifying the version(s) of Mercurial they are tested with, or
    51 # be specifying the version(s) of Mercurial they are tested with, or
    50 # leave the attribute unspecified.
    52 # leave the attribute unspecified.
    51 testedwith = 'internal'
    53 testedwith = 'internal'
   107             raise error.Abort(_('custom scheme %s:// conflicts with drive '
   109             raise error.Abort(_('custom scheme %s:// conflicts with drive '
   108                                'letter %s:\\\n') % (scheme, scheme.upper()))
   110                                'letter %s:\\\n') % (scheme, scheme.upper()))
   109         hg.schemes[scheme] = ShortRepository(url, scheme, t)
   111         hg.schemes[scheme] = ShortRepository(url, scheme, t)
   110 
   112 
   111     extensions.wrapfunction(util, 'hasdriveletter', hasdriveletter)
   113     extensions.wrapfunction(util, 'hasdriveletter', hasdriveletter)
       
   114 
       
   115 @command('debugexpandscheme', norepo=True)
       
   116 def expandscheme(ui, url, **opts):
       
   117     """given a repo path, provide the scheme-expanded path
       
   118     """
       
   119     repo = hg._peerlookup(url)
       
   120     if isinstance(repo, ShortRepository):
       
   121         url = repo.resolve(url)
       
   122     ui.write(url + '\n')