Mercurial > public > mercurial-scm > hg
comparison mercurial/utils/urlutil.py @ 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 | c887bab2dccf |
children | 08630dd719f9 |
comparison
equal
deleted
inserted
replaced
48237:027ebad952ac | 48238:ea50caada82d |
---|---|
816 | 816 |
817 | 817 |
818 class path(object): | 818 class path(object): |
819 """Represents an individual path and its configuration.""" | 819 """Represents an individual path and its configuration.""" |
820 | 820 |
821 def __init__(self, ui=None, name=None, rawloc=None, suboptions=None): | 821 def __init__( |
822 self, | |
823 ui=None, | |
824 name=None, | |
825 rawloc=None, | |
826 suboptions=None, | |
827 validate_path=True, | |
828 ): | |
822 """Construct a path from its config options. | 829 """Construct a path from its config options. |
823 | 830 |
824 ``ui`` is the ``ui`` instance the path is coming from. | 831 ``ui`` is the ``ui`` instance the path is coming from. |
825 ``name`` is the symbolic name of the path. | 832 ``name`` is the symbolic name of the path. |
826 ``rawloc`` is the raw location, as defined in the config. | 833 ``rawloc`` is the raw location, as defined in the config. |
854 | 861 |
855 self.name = name | 862 self.name = name |
856 self.rawloc = rawloc | 863 self.rawloc = rawloc |
857 self.loc = b'%s' % u | 864 self.loc = b'%s' % u |
858 | 865 |
859 self._validate_path() | 866 if validate_path: |
867 self._validate_path() | |
860 | 868 |
861 _path, sub_opts = ui.configsuboptions(b'paths', b'*') | 869 _path, sub_opts = ui.configsuboptions(b'paths', b'*') |
862 self._own_sub_opts = {} | 870 self._own_sub_opts = {} |
863 if suboptions is not None: | 871 if suboptions is not None: |
864 self._own_sub_opts = suboptions.copy() | 872 self._own_sub_opts = suboptions.copy() |