comparison hgext/fsmonitor/__init__.py @ 43362:ddfd0f3956f4 stable

py3: fix fsmonitor's _handleunavailable exception message encoding Differential Revision: https://phab.mercurial-scm.org/D7196
author Emmanuel Leblond <emmanuel.leblond@gmail.com>
date Fri, 01 Nov 2019 10:57:31 -0700
parents 649d3ac37a12
children 65c37b431e76
comparison
equal deleted inserted replaced
43361:9892599de2dc 43362:ddfd0f3956f4
130 registrar, 130 registrar,
131 scmutil, 131 scmutil,
132 util, 132 util,
133 ) 133 )
134 from mercurial import match as matchmod 134 from mercurial import match as matchmod
135 from mercurial.utils import stringutil
135 136
136 from . import ( 137 from . import (
137 pywatchman, 138 pywatchman,
138 state, 139 state,
139 watchmanclient, 140 watchmanclient,
205 def _handleunavailable(ui, state, ex): 206 def _handleunavailable(ui, state, ex):
206 """Exception handler for Watchman interaction exceptions""" 207 """Exception handler for Watchman interaction exceptions"""
207 if isinstance(ex, watchmanclient.Unavailable): 208 if isinstance(ex, watchmanclient.Unavailable):
208 # experimental config: fsmonitor.verbose 209 # experimental config: fsmonitor.verbose
209 if ex.warn and ui.configbool(b'fsmonitor', b'verbose'): 210 if ex.warn and ui.configbool(b'fsmonitor', b'verbose'):
210 if b'illegal_fstypes' not in str(ex): 211 if b'illegal_fstypes' not in stringutil.forcebytestr(ex):
211 ui.warn(str(ex) + b'\n') 212 ui.warn(stringutil.forcebytestr(ex) + b'\n')
212 if ex.invalidate: 213 if ex.invalidate:
213 state.invalidate() 214 state.invalidate()
214 # experimental config: fsmonitor.verbose 215 # experimental config: fsmonitor.verbose
215 if ui.configbool(b'fsmonitor', b'verbose'): 216 if ui.configbool(b'fsmonitor', b'verbose'):
216 ui.log(b'fsmonitor', b'Watchman unavailable: %s\n', ex.msg) 217 ui.log(b'fsmonitor', b'Watchman unavailable: %s\n', ex.msg)