diff mercurial/loggingutil.py @ 46892:4a6024b87dfc

blackbox: fix type error on log rotation on read-only filesystem Grepping around, the code uses either encoding.strtolocal or stringutil.forcebytestr in this situation. No idea which is best. Differential Revision: https://phab.mercurial-scm.org/D10293
author Valentin Gatien-Baron <vgatien-baron@janestreet.com>
date Wed, 31 Mar 2021 17:54:02 -0400
parents 687b865b95ad
children 6000f5b25c9b
line wrap: on
line diff
--- a/mercurial/loggingutil.py	Thu Apr 08 14:38:27 2021 +0200
+++ b/mercurial/loggingutil.py	Wed Mar 31 17:54:02 2021 -0400
@@ -10,7 +10,10 @@
 
 import errno
 
-from . import pycompat
+from . import (
+    encoding,
+    pycompat,
+)
 
 from .utils import (
     dateutil,
@@ -32,7 +35,7 @@
             if err.errno != errno.ENOENT:
                 ui.debug(
                     b"warning: cannot remove '%s': %s\n"
-                    % (newpath, err.strerror)
+                    % (newpath, encoding.strtolocal(err.strerror))
                 )
         try:
             if newpath:
@@ -41,7 +44,7 @@
             if err.errno != errno.ENOENT:
                 ui.debug(
                     b"warning: cannot rename '%s' to '%s': %s\n"
-                    % (newpath, oldpath, err.strerror)
+                    % (newpath, oldpath, encoding.strtolocal(err.strerror))
                 )
 
     if maxsize > 0: