[Updated] D11671: path: add a new argument to control path validation

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Mon Oct 18 10:02:44 UTC 2021


marmoute updated this revision to Diff 30855.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11671?vs=30824&id=30855

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11671/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D11671

AFFECTED FILES
  mercurial/utils/urlutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/urlutil.py b/mercurial/utils/urlutil.py
--- a/mercurial/utils/urlutil.py
+++ b/mercurial/utils/urlutil.py
@@ -818,13 +818,22 @@
 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.
         ``name`` is the symbolic name of the path.
         ``rawloc`` is the raw location, as defined in the config.
         ``pushloc`` is the raw locations pushes should be made to.
+        ``validate_path`` When given a raw location but not a symbolic name,
+                          validate the location is valid at creation time.
 
         If ``name`` is not defined, we require that the location be a) a local
         filesystem path with a .hg directory or b) a URL. If not,
@@ -856,7 +865,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 = {}



To: marmoute, #hg-reviewers, pulkit
Cc: Alphare, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20211018/271a548d/attachment-0002.html>


More information about the Mercurial-patches mailing list