##// END OF EJS Templates
path: extract the path validation logic into its own submethod...
marmoute -
r47580:57218b7f default
parent child Browse files
Show More
@@ -2320,13 +2320,7 b' class path(object):'
2320 2320 self.rawloc = rawloc
2321 2321 self.loc = b'%s' % u
2322 2322
2323 # When given a raw location but not a symbolic name, validate the
2324 # location is valid.
2325 if not name and not u.scheme and not self._isvalidlocalpath(self.loc):
2326 raise ValueError(
2327 b'location is not a URL or path to a local '
2328 b'repo: %s' % rawloc
2329 )
2323 self._validate_path()
2330 2324
2331 2325 _path, sub_opts = ui.configsuboptions(b'paths', b'*')
2332 2326 if suboptions is not None:
@@ -2343,6 +2337,19 b' class path(object):'
2343 2337 value = func(ui, self, sub_opts[suboption])
2344 2338 setattr(self, attr, value)
2345 2339
2340 def _validate_path(self):
2341 # When given a raw location but not a symbolic name, validate the
2342 # location is valid.
2343 if (
2344 not self.name
2345 and not self.url.scheme
2346 and not self._isvalidlocalpath(self.loc)
2347 ):
2348 raise ValueError(
2349 b'location is not a URL or path to a local '
2350 b'repo: %s' % self.rawloc
2351 )
2352
2346 2353 def _isvalidlocalpath(self, path):
2347 2354 """Returns True if the given path is a potentially valid repository.
2348 2355 This is its own function so that extensions can change the definition of
General Comments 0
You need to be logged in to leave comments. Login now