# HG changeset patch # User Matt Harbison # Date 2023-08-21 14:21:58 # 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 @@ import os from .i18n import _ from . import ( + encoding, error, pycompat, util, @@ -229,7 +230,7 @@ class transaction(util.transactional): validator=None, releasefn=None, checkambigfiles=None, - name='', + name=b'', ): """Begin a new transaction @@ -318,7 +319,7 @@ class transaction(util.transactional): def __repr__(self): name = b'/'.join(self._names) return '' % ( - name, + encoding.strfromlocal(name), self._count, self._usages, ) @@ -574,7 +575,7 @@ class transaction(util.transactional): self._file.flush() @active - def nest(self, name=''): + def nest(self, name=b''): self._count += 1 self._usages += 1 self._names.append(name)