fsmonitor: catch watchman issue and fallback

Summary:
My earlier refactor moved a watchmanclient.getcurrentclock() call out
of a "try/except Exception" block. This meant any watchman errors broke the hg
status entirely, instead of falling back to the old status path.

Let's add the logic around this watchman path.

Reviewed By: sfilipco

Differential Revision: D19709391

fbshipit-source-id: bfb0221ba405a926babddaf73c8e70924e4d9b25
This commit is contained in:
Durham Goode 2020-02-03 18:02:29 -08:00 committed by Facebook Github Bot
parent a7246e9781
commit 16d4739981

View File

@ -856,7 +856,13 @@ class fsmonitorfilesystem(filesystem.physicalfilesystem):
if match is None:
match = util.always
startclock = self._watchmanclient.getcurrentclock()
try:
startclock = self._watchmanclient.getcurrentclock()
except Exception as ex:
if self._ui.configbool("fsmonitor", "fallback-on-watchman-exception"):
raise fsmonitorfallback("exception while getting watchman clock")
else:
raise ex
self.dirstate._map.preload()
lookups = []