# HG changeset patch # User Matt Harbison # Date 1736746848 18000 # Node ID 10e7adbffa8c800c80ca1514095ad0e54e192afb # Parent f5471af96a525b09e90a5342522dd767d7e51768 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. diff -r f5471af96a52 -r 10e7adbffa8c mercurial/streamclone.py --- 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'):