mercurial/ui.py
changeset 46827 1ecf082386b7
parent 46826 83b0a5c0dfec
child 46828 395cf404e76a
--- 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