# HG changeset patch # User Pierre-Yves David # Date 1669854467 -3600 # Node ID dd62eb4d2ea55bd85b093704664ddcb83620c4d8 # Parent c4731eee1c8f4ce936311329b71546370ff0919e path: move the url parsing and related attribute setting to a method This will make it simpler to reuse this logic in the next changeset. diff -r c4731eee1c8f -r dd62eb4d2ea5 mercurial/utils/urlutil.py --- a/mercurial/utils/urlutil.py Tue Nov 29 22:22:18 2022 +0100 +++ b/mercurial/utils/urlutil.py Thu Dec 01 01:27:47 2022 +0100 @@ -864,6 +864,24 @@ if not rawloc: raise ValueError(b'rawloc must be defined') + self.name = name + + # set by path variant to point to their "non-push" version + self._setup_url(rawloc) + + if validate_path: + self._validate_path() + + _path, sub_opts = ui.configsuboptions(b'paths', b'*') + self._own_sub_opts = {} + if suboptions is not None: + self._own_sub_opts = suboptions.copy() + sub_opts.update(suboptions) + self._all_sub_opts = sub_opts.copy() + + self._apply_suboptions(ui, sub_opts) + + def _setup_url(self, rawloc): # Locations may define branches via syntax #. u = url(rawloc) branch = None @@ -876,22 +894,9 @@ self.raw_url = u.copy() self.branch = branch - self.name = name self.rawloc = rawloc self.loc = b'%s' % u - if validate_path: - self._validate_path() - - _path, sub_opts = ui.configsuboptions(b'paths', b'*') - self._own_sub_opts = {} - if suboptions is not None: - self._own_sub_opts = suboptions.copy() - sub_opts.update(suboptions) - self._all_sub_opts = sub_opts.copy() - - self._apply_suboptions(ui, sub_opts) - def copy(self): """make a copy of this path object""" new = self.__class__()