comparison 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
comparison
equal deleted inserted replaced
46891:c6ceb5f27f97 46892:4a6024b87dfc
8 8
9 from __future__ import absolute_import 9 from __future__ import absolute_import
10 10
11 import errno 11 import errno
12 12
13 from . import pycompat 13 from . import (
14 encoding,
15 pycompat,
16 )
14 17
15 from .utils import ( 18 from .utils import (
16 dateutil, 19 dateutil,
17 procutil, 20 procutil,
18 stringutil, 21 stringutil,
30 vfs.unlink(newpath) 33 vfs.unlink(newpath)
31 except OSError as err: 34 except OSError as err:
32 if err.errno != errno.ENOENT: 35 if err.errno != errno.ENOENT:
33 ui.debug( 36 ui.debug(
34 b"warning: cannot remove '%s': %s\n" 37 b"warning: cannot remove '%s': %s\n"
35 % (newpath, err.strerror) 38 % (newpath, encoding.strtolocal(err.strerror))
36 ) 39 )
37 try: 40 try:
38 if newpath: 41 if newpath:
39 vfs.rename(oldpath, newpath) 42 vfs.rename(oldpath, newpath)
40 except OSError as err: 43 except OSError as err:
41 if err.errno != errno.ENOENT: 44 if err.errno != errno.ENOENT:
42 ui.debug( 45 ui.debug(
43 b"warning: cannot rename '%s' to '%s': %s\n" 46 b"warning: cannot rename '%s' to '%s': %s\n"
44 % (newpath, oldpath, err.strerror) 47 % (newpath, oldpath, encoding.strtolocal(err.strerror))
45 ) 48 )
46 49
47 if maxsize > 0: 50 if maxsize > 0:
48 try: 51 try:
49 st = vfs.stat(name) 52 st = vfs.stat(name)