# HG changeset patch # User Pierre-Yves David # Date 2021-10-15 00:36:38 # Node ID ea50caada82d271c2d3906d131819eb4835aa032 # Parent 027ebad952ac69f1427ce0b7525f5d0742701dd8 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 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 @@ def _chain_path(base_path, ui, paths): 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 @@ class path(object): 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 = {}