Patchwork D11671: path: add a new argument to control path validation

login
register
mail settings
Submitter phabricator
Date Oct. 15, 2021, 8:18 a.m.
Message ID <differential-rev-PHID-DREV-xc35fg7jhtgkcfvkwllm-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49995/
State Superseded
Headers show

Comments

phabricator - Oct. 15, 2021, 8:18 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/utils/urlutil.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/utils/urlutil.py b/mercurial/utils/urlutil.py
--- a/mercurial/utils/urlutil.py
+++ b/mercurial/utils/urlutil.py
@@ -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 = {}