##// END OF EJS Templates
scheme: move the drive letter checking in its own function...
marmoute -
r50970:1863584f default
parent child Browse files
Show More
@@ -119,23 +119,24 b' schemes = {'
119 119 }
120 120
121 121
122 def _check_drive_letter(scheme):
123 """check if a scheme conflict with a Windows drive letter"""
124 if (
125 pycompat.iswindows
126 and len(scheme) == 1
127 and scheme.isalpha()
128 and os.path.exists(b'%s:\\' % scheme)
129 ):
130 msg = _(b'custom scheme %s:// conflicts with drive letter %s:\\\n')
131 msg %= (scheme, scheme.upper())
132 raise error.Abort(msg)
133
134
122 135 def extsetup(ui):
123 136 schemes.update(dict(ui.configitems(b'schemes')))
124 137 t = templater.engine(templater.parse)
125 138 for scheme, url in schemes.items():
126 if (
127 pycompat.iswindows
128 and len(scheme) == 1
129 and scheme.isalpha()
130 and os.path.exists(b'%s:\\' % scheme)
131 ):
132 raise error.Abort(
133 _(
134 b'custom scheme %s:// conflicts with drive '
135 b'letter %s:\\\n'
136 )
137 % (scheme, scheme.upper())
138 )
139 _check_drive_letter(schemes)
139 140 url_scheme = urlutil.url(url).scheme
140 141 if url_scheme in hg.peer_schemes:
141 142 hg.peer_schemes[scheme] = ShortRepository(url, scheme, t)
General Comments 0
You need to be logged in to leave comments. Login now