Mercurial > public > mercurial-scm > hg
comparison mercurial/ui.py @ 46827:1ecf082386b7
path: forbid chaining `path://` definitions
To have `path://xxx` referencing paths that use `path://` too, we need to
analyze dependencies to initialize them in the right order (and to detect
cycle).
I don't want to deal with that right now, so I just disallow it for now.
Differential Revision: https://phab.mercurial-scm.org/D10264
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 23 Mar 2021 23:55:33 +0100 |
parents | 83b0a5c0dfec |
children | 395cf404e76a |
comparison
equal
deleted
inserted
replaced
46826:83b0a5c0dfec | 46827:1ecf082386b7 |
---|---|
2315 if u.fragment: | 2315 if u.fragment: |
2316 branch = u.fragment | 2316 branch = u.fragment |
2317 u.fragment = None | 2317 u.fragment = None |
2318 | 2318 |
2319 self.url = u | 2319 self.url = u |
2320 # the url from the config/command line before dealing with `path://` | |
2321 self.raw_url = u.copy() | |
2320 self.branch = branch | 2322 self.branch = branch |
2321 | 2323 |
2322 self.name = name | 2324 self.name = name |
2323 self.rawloc = rawloc | 2325 self.rawloc = rawloc |
2324 self.loc = b'%s' % u | 2326 self.loc = b'%s' % u |
2336 | 2338 |
2337 def chain_path(self, ui, paths): | 2339 def chain_path(self, ui, paths): |
2338 if self.url.scheme == b'path': | 2340 if self.url.scheme == b'path': |
2339 assert self.url.path is None | 2341 assert self.url.path is None |
2340 subpath = paths[self.url.host] | 2342 subpath = paths[self.url.host] |
2343 if subpath.raw_url.scheme == b'path': | |
2344 m = _('cannot use `%s`, "%s" is also define as a `path://`') | |
2345 m %= (self.rawloc, self.url.host) | |
2346 raise error.Abort(m) | |
2341 self.url = subpath.url | 2347 self.url = subpath.url |
2342 self.rawloc = subpath.rawloc | 2348 self.rawloc = subpath.rawloc |
2343 self.loc = subpath.loc | 2349 self.loc = subpath.loc |
2344 if self.branch is None: | 2350 if self.branch is None: |
2345 self.branch = subpath.branch | 2351 self.branch = subpath.branch |