hgext/fsmonitor/__init__.py
branchstable
changeset 49468 2905b78fc52e
parent 49044 be9bf75a837c
child 50778 ba3add904ab4
equal deleted inserted replaced
49467:0705afae6253 49468:2905b78fc52e
   115 import tempfile
   115 import tempfile
   116 import weakref
   116 import weakref
   117 
   117 
   118 from mercurial.i18n import _
   118 from mercurial.i18n import _
   119 from mercurial.node import hex
   119 from mercurial.node import hex
       
   120 
   120 from mercurial.pycompat import open
   121 from mercurial.pycompat import open
   121 from mercurial import (
   122 from mercurial import (
   122     context,
   123     context,
   123     encoding,
   124     encoding,
   124     error,
   125     error,
   129     pycompat,
   130     pycompat,
   130     registrar,
   131     registrar,
   131     scmutil,
   132     scmutil,
   132     util,
   133     util,
   133 )
   134 )
       
   135 
       
   136 # no-check-code because we're accessing private information only public in pure
       
   137 from mercurial.pure import parsers
   134 from mercurial import match as matchmod
   138 from mercurial import match as matchmod
   135 from mercurial.utils import (
   139 from mercurial.utils import (
   136     hashutil,
   140     hashutil,
   137     stringutil,
   141     stringutil,
   138 )
   142 )
   330     dmap = self._map
   334     dmap = self._map
   331     if util.safehasattr(dmap, b'_map'):
   335     if util.safehasattr(dmap, b'_map'):
   332         # for better performance, directly access the inner dirstate map if the
   336         # for better performance, directly access the inner dirstate map if the
   333         # standard dirstate implementation is in use.
   337         # standard dirstate implementation is in use.
   334         dmap = dmap._map
   338         dmap = dmap._map
       
   339 
       
   340     has_mtime = parsers.DIRSTATE_V2_HAS_MTIME
       
   341     mtime_is_ambiguous = parsers.DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS
       
   342     mask = has_mtime | mtime_is_ambiguous
       
   343 
       
   344     # All entries that may not be clean
   335     nonnormalset = {
   345     nonnormalset = {
   336         f
   346         f
   337         for f, e in self._map.items()
   347         for f, e in self._map.items()
   338         if e._v1_state() != b"n" or e._v1_mtime() == -1
   348         if not e.maybe_clean
       
   349         # same as "not has_time or has_ambiguous_time", but factored to only
       
   350         # need a single access to flags for performance.
       
   351         # `mask` removes all irrelevant bits, then we flip the `mtime` bit so
       
   352         # its `true` value is NOT having a mtime, then check if either bit
       
   353         # is set.
       
   354         or bool((e.v2_data()[0] & mask) ^ has_mtime)
   339     }
   355     }
   340 
   356 
   341     copymap = self._map.copymap
   357     copymap = self._map.copymap
   342     getkind = stat.S_IFMT
   358     getkind = stat.S_IFMT
   343     dirkind = stat.S_IFDIR
   359     dirkind = stat.S_IFDIR