Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/loggingutil.py @ 43077:687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Done with
python3.7 contrib/byteify-strings.py -i $(hg files 'set:mercurial/**.py - mercurial/thirdparty/** + hgext/**.py - hgext/fsmonitor/pywatchman/** - mercurial/__init__.py')
black -l 80 -t py33 -S $(hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**')
# skip-blame mass-reformatting only
Differential Revision: https://phab.mercurial-scm.org/D6972
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:48:39 -0400 |
parents | 2372284d9457 |
children | 4a6024b87dfc |
comparison
equal
deleted
inserted
replaced
43076:2372284d9457 | 43077:687b865b95ad |
---|---|
29 try: | 29 try: |
30 vfs.unlink(newpath) | 30 vfs.unlink(newpath) |
31 except OSError as err: | 31 except OSError as err: |
32 if err.errno != errno.ENOENT: | 32 if err.errno != errno.ENOENT: |
33 ui.debug( | 33 ui.debug( |
34 "warning: cannot remove '%s': %s\n" | 34 b"warning: cannot remove '%s': %s\n" |
35 % (newpath, err.strerror) | 35 % (newpath, err.strerror) |
36 ) | 36 ) |
37 try: | 37 try: |
38 if newpath: | 38 if newpath: |
39 vfs.rename(oldpath, newpath) | 39 vfs.rename(oldpath, newpath) |
40 except OSError as err: | 40 except OSError as err: |
41 if err.errno != errno.ENOENT: | 41 if err.errno != errno.ENOENT: |
42 ui.debug( | 42 ui.debug( |
43 "warning: cannot rename '%s' to '%s': %s\n" | 43 b"warning: cannot rename '%s' to '%s': %s\n" |
44 % (newpath, oldpath, err.strerror) | 44 % (newpath, oldpath, err.strerror) |
45 ) | 45 ) |
46 | 46 |
47 if maxsize > 0: | 47 if maxsize > 0: |
48 try: | 48 try: |
52 else: | 52 else: |
53 if st.st_size >= maxsize: | 53 if st.st_size >= maxsize: |
54 path = vfs.join(name) | 54 path = vfs.join(name) |
55 for i in pycompat.xrange(maxfiles - 1, 1, -1): | 55 for i in pycompat.xrange(maxfiles - 1, 1, -1): |
56 rotate( | 56 rotate( |
57 oldpath='%s.%d' % (path, i - 1), | 57 oldpath=b'%s.%d' % (path, i - 1), |
58 newpath='%s.%d' % (path, i), | 58 newpath=b'%s.%d' % (path, i), |
59 ) | 59 ) |
60 rotate(oldpath=path, newpath=maxfiles > 0 and path + '.1') | 60 rotate(oldpath=path, newpath=maxfiles > 0 and path + b'.1') |
61 return vfs(name, 'a', makeparentdirs=False) | 61 return vfs(name, b'a', makeparentdirs=False) |
62 | 62 |
63 | 63 |
64 def _formatlogline(msg): | 64 def _formatlogline(msg): |
65 date = dateutil.datestr(format=b'%Y/%m/%d %H:%M:%S') | 65 date = dateutil.datestr(format=b'%Y/%m/%d %H:%M:%S') |
66 pid = procutil.getpid() | 66 pid = procutil.getpid() |