diff 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
line wrap: on
line diff
--- a/mercurial/ui.py	Thu Mar 18 12:02:01 2021 +0100
+++ b/mercurial/ui.py	Tue Mar 23 23:55:33 2021 +0100
@@ -2317,6 +2317,8 @@
             u.fragment = None
 
         self.url = u
+        # the url from the config/command line before dealing with `path://`
+        self.raw_url = u.copy()
         self.branch = branch
 
         self.name = name
@@ -2338,6 +2340,10 @@
         if self.url.scheme == b'path':
             assert self.url.path is None
             subpath = paths[self.url.host]
+            if subpath.raw_url.scheme == b'path':
+                m = _('cannot use `%s`, "%s" is also define as a `path://`')
+                m %= (self.rawloc, self.url.host)
+                raise error.Abort(m)
             self.url = subpath.url
             self.rawloc = subpath.rawloc
             self.loc = subpath.loc