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