hgext/schemes.py
changeset 30640 7a3e67bfa417
parent 29841 d5883fd055c6
child 31181 150cd5125722
equal deleted inserted replaced
30639:d524c88511a7 30640:7a3e67bfa417
    48 from mercurial import (
    48 from mercurial import (
    49     cmdutil,
    49     cmdutil,
    50     error,
    50     error,
    51     extensions,
    51     extensions,
    52     hg,
    52     hg,
       
    53     pycompat,
    53     templater,
    54     templater,
    54     util,
    55     util,
    55 )
    56 )
    56 
    57 
    57 cmdtable = {}
    58 cmdtable = {}
   112 
   113 
   113 def extsetup(ui):
   114 def extsetup(ui):
   114     schemes.update(dict(ui.configitems('schemes')))
   115     schemes.update(dict(ui.configitems('schemes')))
   115     t = templater.engine(lambda x: x)
   116     t = templater.engine(lambda x: x)
   116     for scheme, url in schemes.items():
   117     for scheme, url in schemes.items():
   117         if (os.name == 'nt' and len(scheme) == 1 and scheme.isalpha()
   118         if (pycompat.osname == 'nt' and len(scheme) == 1 and scheme.isalpha()
   118             and os.path.exists('%s:\\' % scheme)):
   119             and os.path.exists('%s:\\' % scheme)):
   119             raise error.Abort(_('custom scheme %s:// conflicts with drive '
   120             raise error.Abort(_('custom scheme %s:// conflicts with drive '
   120                                'letter %s:\\\n') % (scheme, scheme.upper()))
   121                                'letter %s:\\\n') % (scheme, scheme.upper()))
   121         hg.schemes[scheme] = ShortRepository(url, scheme, t)
   122         hg.schemes[scheme] = ShortRepository(url, scheme, t)
   122 
   123