Patchwork [1,of,2] fsmonitor: fix exception message scraping

login
register
mail settings
Submitter via Mercurial-devel
Date Dec. 21, 2016, 4:53 a.m.
Message ID <445efa4de2742e3ba964.1482296038@dev7794.prn1.facebook.com>
Download mbox | patch
Permalink /patch/18001/
State Superseded
Headers show

Comments

via Mercurial-devel - Dec. 21, 2016, 4:53 a.m.
# HG changeset patch
# User zphricz <zack.hricz@oculus.com>
# Date 1482295130 28800
#      Tue Dec 20 20:38:50 2016 -0800
# Node ID 445efa4de2742e3ba964bdabcce86897e53f0423
# Parent  6f9fcd29e29016587a5a7ac3157baec3eb39a134
fsmonitor: fix exception message scraping

pywatchman.CommandError formats its error message such that
'unable to resolve root' is not a prefix. This change fixes that by
instead just searching for it as a substring.

Patch

diff --git a/hgext/fsmonitor/watchmanclient.py b/hgext/fsmonitor/watchmanclient.py
--- a/hgext/fsmonitor/watchmanclient.py
+++ b/hgext/fsmonitor/watchmanclient.py
@@ -87,7 +87,7 @@ 
                     useImmutableBser=True)
             return self._watchmanclient.query(*watchmanargs)
         except pywatchman.CommandError as ex:
-            if ex.msg.startswith('unable to resolve root'):
+            if 'unable to resolve root' in ex.msg:
                 raise WatchmanNoRoot(self._root, ex.msg)
             raise Unavailable(ex.msg)
         except pywatchman.WatchmanError as ex: