# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1572725300 25200
#      Sat Nov 02 13:08:20 2019 -0700
# Branch stable
# Node ID 5fa8ac91190e1f5ae879497323710184273abc0d
# Parent  e6ce1599af74467a38065c9640d16be1a1ff3309
fsmonitor: coerce watchman exception to bytes

Without this, we get errors due to passing str to a function
which expects bytes.

Differential Revision: https://phab.mercurial-scm.org/D7206

diff --git a/hgext/fsmonitor/__init__.py b/hgext/fsmonitor/__init__.py
--- a/hgext/fsmonitor/__init__.py
+++ b/hgext/fsmonitor/__init__.py
@@ -214,9 +214,17 @@
             state.invalidate()
         # experimental config: fsmonitor.verbose
         if ui.configbool(b'fsmonitor', b'verbose'):
-            ui.log(b'fsmonitor', b'Watchman unavailable: %s\n', ex.msg)
+            ui.log(
+                b'fsmonitor',
+                b'Watchman unavailable: %s\n',
+                stringutil.forcebytestr(ex.msg),
+            )
     else:
-        ui.log(b'fsmonitor', b'Watchman exception: %s\n', ex)
+        ui.log(
+            b'fsmonitor',
+            b'Watchman exception: %s\n',
+            stringutil.forcebytestr(ex),
+        )
 
 
 def _hashignore(ignore):