Mercurial > public > mercurial-scm > hg-stable
changeset 52714:10e7adbffa8c
streamclone: unbyteify string args to builtin Error classes
This avoids printing the error with a `b''` prefix in the case of `ValueError`.
The custom `ProgrammingError` class is special in that it won't do that, and can
take either bytes or str. But there's no point in passing bytes when it is just
going to decode to str at runtime anyway.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 13 Jan 2025 00:40:48 -0500 |
parents | f5471af96a52 |
children | f3762eafed66 |
files | mercurial/streamclone.py |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/streamclone.py Mon Jan 13 00:36:25 2025 -0500 +++ b/mercurial/streamclone.py Mon Jan 13 00:40:48 2025 -0500 @@ -365,7 +365,7 @@ Returns a tuple of (requirements, data generator). """ if compression != b'UN': - raise ValueError(b'we do not support the compression argument yet') + raise ValueError('we do not support the compression argument yet') requirements = streamed_requirements(repo) requires = b','.join(sorted(requirements)) @@ -728,7 +728,7 @@ # fine, while this is really not fine. if repo.vfs in vfsmap.values(): raise error.ProgrammingError( - b'repo.vfs must not be added to vfsmap for security reasons' + 'repo.vfs must not be added to vfsmap for security reasons' ) # translate the vfs one @@ -795,7 +795,7 @@ # fine, while this is really not fine. if repo.vfs in vfsmap.values(): raise error.ProgrammingError( - b'repo.vfs must not be added to vfsmap for security reasons' + 'repo.vfs must not be added to vfsmap for security reasons' ) # translate the vfs once @@ -1074,7 +1074,7 @@ # is fine, while this is really not fine. if repo.vfs in vfsmap.values(): raise error.ProgrammingError( - b'repo.vfs must not be added to vfsmap for security reasons' + 'repo.vfs must not be added to vfsmap for security reasons' ) with repo.transaction(b'clone'): @@ -1145,7 +1145,7 @@ # is fine, while this is really not fine. if repo.vfs in vfsmap.values(): raise error.ProgrammingError( - b'repo.vfs must not be added to vfsmap for security reasons' + 'repo.vfs must not be added to vfsmap for security reasons' ) with repo.transaction(b'clone'):