# HG changeset patch # User Matt Harbison <matt_harbison@yahoo.com> # Date 1692627718 14400 # Mon Aug 21 10:21:58 2023 -0400 # Branch stable # Node ID 0a4efb650b3efedbce997ee6e05d8487579d41f6 # Parent 181936ad069a0d958a6605b996158b60a0dc0a5e transaction: fix __repr__() and make the default name bytes This likely was always wrong on py3, since going back to aff5996f3043, these were added as a r-strings. Callers seem to always be supplying bytes, which makes the `b'/'.join(...)` part OK, but then bytes can't be interpolated into str with "%s", so it wouldn't have worked in either case. diff --git a/mercurial/transaction.py b/mercurial/transaction.py --- a/mercurial/transaction.py +++ b/mercurial/transaction.py @@ -16,6 +16,7 @@ from .i18n import _ from . import ( + encoding, error, pycompat, util, @@ -229,7 +230,7 @@ validator=None, releasefn=None, checkambigfiles=None, - name='<unnamed>', + name=b'<unnamed>', ): """Begin a new transaction @@ -318,7 +319,7 @@ def __repr__(self): name = b'/'.join(self._names) return '<transaction name=%s, count=%d, usages=%d>' % ( - name, + encoding.strfromlocal(name), self._count, self._usages, ) @@ -574,7 +575,7 @@ self._file.flush() @active - def nest(self, name='<unnamed>'): + def nest(self, name=b'<unnamed>'): self._count += 1 self._usages += 1 self._names.append(name)