comparison mercurial/ui.py @ 46828:395cf404e76a

path: error out if the `path://` reference point to an unknown path Differential Revision: https://phab.mercurial-scm.org/D10265
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 24 Mar 2021 00:04:58 +0100
parents 1ecf082386b7
children 33524c46a092
comparison
equal deleted inserted replaced
46827:1ecf082386b7 46828:395cf404e76a
2337 self._apply_suboptions(ui, sub_opts) 2337 self._apply_suboptions(ui, sub_opts)
2338 2338
2339 def chain_path(self, ui, paths): 2339 def chain_path(self, ui, paths):
2340 if self.url.scheme == b'path': 2340 if self.url.scheme == b'path':
2341 assert self.url.path is None 2341 assert self.url.path is None
2342 subpath = paths[self.url.host] 2342 try:
2343 subpath = paths[self.url.host]
2344 except KeyError:
2345 m = _('cannot use `%s`, "%s" is not a known path')
2346 m %= (self.rawloc, self.url.host)
2347 raise error.Abort(m)
2343 if subpath.raw_url.scheme == b'path': 2348 if subpath.raw_url.scheme == b'path':
2344 m = _('cannot use `%s`, "%s" is also define as a `path://`') 2349 m = _('cannot use `%s`, "%s" is also define as a `path://`')
2345 m %= (self.rawloc, self.url.host) 2350 m %= (self.rawloc, self.url.host)
2346 raise error.Abort(m) 2351 raise error.Abort(m)
2347 self.url = subpath.url 2352 self.url = subpath.url