Mercurial > public > mercurial-scm > hg
comparison mercurial/utils/urlutil.py @ 50906:35885dbdc927
path-suboption: deprecated specifying the attributes as bytes
The known suboptions have been updated, so we can deprecated passing bytes in case
some extensions use them.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 30 Aug 2023 00:50:28 +0200 |
parents | ceac1bd816f7 |
children | 18c8c18993f0 |
comparison
equal
deleted
inserted
replaced
50905:ceac1bd816f7 | 50906:35885dbdc927 |
---|---|
16 from .. import ( | 16 from .. import ( |
17 encoding, | 17 encoding, |
18 error, | 18 error, |
19 pycompat, | 19 pycompat, |
20 urllibcompat, | 20 urllibcompat, |
21 util, | |
21 ) | 22 ) |
22 | 23 |
23 from . import ( | 24 from . import ( |
24 stringutil, | 25 stringutil, |
25 ) | 26 ) |
679 the value when displayed to the user (like in `hg paths` for example). | 680 the value when displayed to the user (like in `hg paths` for example). |
680 | 681 |
681 This decorator can be used to perform additional verification of | 682 This decorator can be used to perform additional verification of |
682 sub-options and to change the type of sub-options. | 683 sub-options and to change the type of sub-options. |
683 """ | 684 """ |
685 if isinstance(attr, bytes): | |
686 msg = b'pathsuboption take `str` as "attr" argument, not `bytes`' | |
687 util.nouideprecwarn(msg, b"6.6", stacklevel=2) | |
688 attr = attr.decode('ascii') | |
684 | 689 |
685 def register(func): | 690 def register(func): |
686 _pathsuboptions[option] = (attr, func) | 691 _pathsuboptions[option] = (attr, func) |
687 path_suboptions_display[option] = display | 692 path_suboptions_display[option] = display |
688 return func | 693 return func |