Mercurial > hg
comparison hgext/fsmonitor/__init__.py @ 35146:0b5716ec8500
fsmonitor: issue debug messages when we fall back to core status
Having more information about when and why fsmonitor bails out help when
looking into status performance.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Tue, 28 Nov 2017 11:00:54 -0500 |
parents | ae7ad53d3c8d |
children | 73abb81ccb28 |
comparison
equal
deleted
inserted
replaced
35145:25c543944bc0 | 35146:0b5716ec8500 |
---|---|
222 '''Replacement for dirstate.walk, hooking into Watchman. | 222 '''Replacement for dirstate.walk, hooking into Watchman. |
223 | 223 |
224 Whenever full is False, ignored is False, and the Watchman client is | 224 Whenever full is False, ignored is False, and the Watchman client is |
225 available, use Watchman combined with saved state to possibly return only a | 225 available, use Watchman combined with saved state to possibly return only a |
226 subset of files.''' | 226 subset of files.''' |
227 def bail(): | 227 def bail(reason): |
228 self._ui.debug('fsmonitor: fallback to core status, %s\n' % reason) | |
228 return orig(match, subrepos, unknown, ignored, full=True) | 229 return orig(match, subrepos, unknown, ignored, full=True) |
229 | 230 |
230 if full or ignored or not self._watchmanclient.available(): | 231 if full: |
231 return bail() | 232 return bail('full rewalk requested') |
233 if ignored: | |
234 return bail('listing ignored files') | |
235 if not self._watchmanclient.available(): | |
236 return bail('client unavailable') | |
232 state = self._fsmonitorstate | 237 state = self._fsmonitorstate |
233 clock, ignorehash, notefiles = state.get() | 238 clock, ignorehash, notefiles = state.get() |
234 if not clock: | 239 if not clock: |
235 if state.walk_on_invalidate: | 240 if state.walk_on_invalidate: |
236 return bail() | 241 return bail('no clock') |
237 # Initial NULL clock value, see | 242 # Initial NULL clock value, see |
238 # https://facebook.github.io/watchman/docs/clockspec.html | 243 # https://facebook.github.io/watchman/docs/clockspec.html |
239 clock = 'c:0:0' | 244 clock = 'c:0:0' |
240 notefiles = [] | 245 notefiles = [] |
241 | 246 |
261 dirignore = self._dirignore | 266 dirignore = self._dirignore |
262 if unknown: | 267 if unknown: |
263 if _hashignore(ignore) != ignorehash and clock != 'c:0:0': | 268 if _hashignore(ignore) != ignorehash and clock != 'c:0:0': |
264 # ignore list changed -- can't rely on Watchman state any more | 269 # ignore list changed -- can't rely on Watchman state any more |
265 if state.walk_on_invalidate: | 270 if state.walk_on_invalidate: |
266 return bail() | 271 return bail('ignore rules changed') |
267 notefiles = [] | 272 notefiles = [] |
268 clock = 'c:0:0' | 273 clock = 'c:0:0' |
269 else: | 274 else: |
270 # always ignore | 275 # always ignore |
271 ignore = util.always | 276 ignore = util.always |
336 'empty_on_fresh_instance': state.walk_on_invalidate, | 341 'empty_on_fresh_instance': state.walk_on_invalidate, |
337 }) | 342 }) |
338 except Exception as ex: | 343 except Exception as ex: |
339 _handleunavailable(self._ui, state, ex) | 344 _handleunavailable(self._ui, state, ex) |
340 self._watchmanclient.clearconnection() | 345 self._watchmanclient.clearconnection() |
341 return bail() | 346 return bail('exception during run') |
342 else: | 347 else: |
343 # We need to propagate the last observed clock up so that we | 348 # We need to propagate the last observed clock up so that we |
344 # can use it for our next query | 349 # can use it for our next query |
345 state.setlastclock(result['clock']) | 350 state.setlastclock(result['clock']) |
346 if result['is_fresh_instance']: | 351 if result['is_fresh_instance']: |
347 if state.walk_on_invalidate: | 352 if state.walk_on_invalidate: |
348 state.invalidate() | 353 state.invalidate() |
349 return bail() | 354 return bail('fresh instance') |
350 fresh_instance = True | 355 fresh_instance = True |
351 # Ignore any prior noteable files from the state info | 356 # Ignore any prior noteable files from the state info |
352 notefiles = [] | 357 notefiles = [] |
353 | 358 |
354 # for file paths which require normalization and we encounter a case | 359 # for file paths which require normalization and we encounter a case |