changeset 48238:ea50caada82d

path: add a new argument to control path validation During pull, unvalidated path might be used, having the option to do so directly will allow use to simplify some code and unlock more `path` usage later in the series. Differential Revision: https://phab.mercurial-scm.org/D11671
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 15 Oct 2021 02:36:38 +0200
parents 027ebad952ac
children 08630dd719f9
files mercurial/utils/urlutil.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/utils/urlutil.py	Fri Oct 15 14:05:20 2021 +0100
+++ b/mercurial/utils/urlutil.py	Fri Oct 15 02:36:38 2021 +0200
@@ -818,7 +818,14 @@
 class path(object):
     """Represents an individual path and its configuration."""
 
-    def __init__(self, ui=None, name=None, rawloc=None, suboptions=None):
+    def __init__(
+        self,
+        ui=None,
+        name=None,
+        rawloc=None,
+        suboptions=None,
+        validate_path=True,
+    ):
         """Construct a path from its config options.
 
         ``ui`` is the ``ui`` instance the path is coming from.
@@ -856,7 +863,8 @@
         self.rawloc = rawloc
         self.loc = b'%s' % u
 
-        self._validate_path()
+        if validate_path:
+            self._validate_path()
 
         _path, sub_opts = ui.configsuboptions(b'paths', b'*')
         self._own_sub_opts = {}