fsmonitor: only access inner dirstate map if it is available
authorMark Thomas <mbthomas@fb.com>
Wed, 15 Nov 2017 01:07:42 -0800
changeset 35108 ae7ad53d3c8d
parent 35107 61888bd0b300
child 35109 8db4ca768416
fsmonitor: only access inner dirstate map if it is available As part of the dirstate refactor, fsmonitor was updated to directly access the inner map of the dirstatemap object. Dirstatemap reimplementations may not use a map like this, so only access it if it is there. Differential Revision: https://phab.mercurial-scm.org/D1346
hgext/fsmonitor/__init__.py
--- a/hgext/fsmonitor/__init__.py	Wed Nov 15 01:07:42 2017 -0800
+++ b/hgext/fsmonitor/__init__.py	Wed Nov 15 01:07:42 2017 -0800
@@ -273,7 +273,11 @@
 
     matchfn = match.matchfn
     matchalways = match.always()
-    dmap = self._map._map
+    dmap = self._map
+    if util.safehasattr(dmap, '_map'):
+        # for better performance, directly access the inner dirstate map if the
+        # standard dirstate implementation is in use.
+        dmap = dmap._map
     nonnormalset = self._map.nonnormalset
 
     copymap = self._map.copymap