Mercurial > public > mercurial-scm > hg
comparison mercurial/utils/urlutil.py @ 51135:5c9c41273367
cleanup: turn `pathsuboption` deprecation warning into an error
We could simply drop the check, but lets raise explicit error instead of
suffering strange error in case of misuse.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 08 Nov 2023 22:17:41 +0100 |
parents | 591845f89ada |
children | 9d3721552b6c |
comparison
equal
deleted
inserted
replaced
51134:d8f65fc72e7b | 51135:5c9c41273367 |
---|---|
12 from .. import ( | 12 from .. import ( |
13 encoding, | 13 encoding, |
14 error, | 14 error, |
15 pycompat, | 15 pycompat, |
16 urllibcompat, | 16 urllibcompat, |
17 util, | |
18 ) | 17 ) |
19 | 18 |
20 from . import ( | 19 from . import ( |
21 stringutil, | 20 stringutil, |
22 ) | 21 ) |
678 This decorator can be used to perform additional verification of | 677 This decorator can be used to perform additional verification of |
679 sub-options and to change the type of sub-options. | 678 sub-options and to change the type of sub-options. |
680 """ | 679 """ |
681 if isinstance(attr, bytes): | 680 if isinstance(attr, bytes): |
682 msg = b'pathsuboption take `str` as "attr" argument, not `bytes`' | 681 msg = b'pathsuboption take `str` as "attr" argument, not `bytes`' |
683 util.nouideprecwarn(msg, b"6.6", stacklevel=2) | 682 raise TypeError(msg) |
684 attr = attr.decode('ascii') | |
685 | 683 |
686 def register(func): | 684 def register(func): |
687 _pathsuboptions[option] = (attr, func) | 685 _pathsuboptions[option] = (attr, func) |
688 path_suboptions_display[option] = display | 686 path_suboptions_display[option] = display |
689 return func | 687 return func |