Mercurial > public > mercurial-scm > hg
comparison mercurial/utils/urlutil.py @ 49706:f27fbb908b10
path: deprecated the `pushloc` attribute
We want to make sure people with use the full featured path "variant".
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 01 Dec 2022 01:46:46 +0100 |
parents | 1fae401b3b14 |
children | ce5f49e8d6ed |
comparison
equal
deleted
inserted
replaced
49705:ec8140c44b14 | 49706:f27fbb908b10 |
---|---|
734 return func | 734 return func |
735 | 735 |
736 return register | 736 return register |
737 | 737 |
738 | 738 |
739 @pathsuboption(b'pushurl', b'pushloc') | 739 @pathsuboption(b'pushurl', b'_pushloc') |
740 def pushurlpathoption(ui, path, value): | 740 def pushurlpathoption(ui, path, value): |
741 u = url(value) | 741 u = url(value) |
742 # Actually require a URL. | 742 # Actually require a URL. |
743 if not u.scheme: | 743 if not u.scheme: |
744 msg = _(b'(paths.%s:pushurl not a URL; ignoring: "%s")\n') | 744 msg = _(b'(paths.%s:pushurl not a URL; ignoring: "%s")\n') |
846 """Construct a path from its config options. | 846 """Construct a path from its config options. |
847 | 847 |
848 ``ui`` is the ``ui`` instance the path is coming from. | 848 ``ui`` is the ``ui`` instance the path is coming from. |
849 ``name`` is the symbolic name of the path. | 849 ``name`` is the symbolic name of the path. |
850 ``rawloc`` is the raw location, as defined in the config. | 850 ``rawloc`` is the raw location, as defined in the config. |
851 ``pushloc`` is the raw locations pushes should be made to. | 851 ``_pushloc`` is the raw locations pushes should be made to. |
852 (see the `get_push_variant` method) | |
852 | 853 |
853 If ``name`` is not defined, we require that the location be a) a local | 854 If ``name`` is not defined, we require that the location be a) a local |
854 filesystem path with a .hg directory or b) a URL. If not, | 855 filesystem path with a .hg directory or b) a URL. If not, |
855 ``ValueError`` is raised. | 856 ``ValueError`` is raised. |
856 """ | 857 """ |
922 """ | 923 """ |
923 if self.main_path: | 924 if self.main_path: |
924 return self | 925 return self |
925 new = self.copy() | 926 new = self.copy() |
926 new.main_path = self | 927 new.main_path = self |
927 if self.pushloc: | 928 if self._pushloc: |
928 new._setup_url(self.pushloc) | 929 new._setup_url(self._pushloc) |
929 return new | 930 return new |
931 | |
932 def pushloc(self): | |
933 """compatibility layer for the deprecated attributes""" | |
934 from .. import util # avoid a cycle | |
935 | |
936 msg = "don't use path.pushloc, use path.get_push_variant()" | |
937 util.nouideprecwarn(msg, b"6.5") | |
938 return self._pushloc | |
930 | 939 |
931 def _validate_path(self): | 940 def _validate_path(self): |
932 # When given a raw location but not a symbolic name, validate the | 941 # When given a raw location but not a symbolic name, validate the |
933 # location is valid. | 942 # location is valid. |
934 if ( | 943 if ( |