Mercurial > hg
comparison hgext/fsmonitor/__init__.py @ 34897:2e350d2a0eca
fsmonitor: use nonnormalset from dirstatemap
`dirstate._nonnormalset` has been moved to `dirstate._map.nonnormalset` by
60927b19ed65 (dirstate: move nonnormal and otherparent sets to dirstatemap)
and is guaranteed to be existed.
Let's update fsmonitor code to use the new `nonnormalset`. Thix fixed a perf
regression that slows down `hg status` by 0.5 seconds in one of our
production repos.
Differential Revision: https://phab.mercurial-scm.org/D1184
author | Jun Wu <quark@fb.com> |
---|---|
date | Wed, 18 Oct 2017 15:42:44 -0700 |
parents | dbb542326582 |
children | ae7ad53d3c8d |
comparison
equal
deleted
inserted
replaced
34896:97017508c863 | 34897:2e350d2a0eca |
---|---|
272 dirignore = util.always | 272 dirignore = util.always |
273 | 273 |
274 matchfn = match.matchfn | 274 matchfn = match.matchfn |
275 matchalways = match.always() | 275 matchalways = match.always() |
276 dmap = self._map._map | 276 dmap = self._map._map |
277 nonnormalset = getattr(self, '_nonnormalset', None) | 277 nonnormalset = self._map.nonnormalset |
278 | 278 |
279 copymap = self._map.copymap | 279 copymap = self._map.copymap |
280 getkind = stat.S_IFMT | 280 getkind = stat.S_IFMT |
281 dirkind = stat.S_IFDIR | 281 dirkind = stat.S_IFDIR |
282 regkind = stat.S_IFREG | 282 regkind = stat.S_IFREG |
402 notefiles = set((normalize(f, True, True) for f in notefiles | 402 notefiles = set((normalize(f, True, True) for f in notefiles |
403 if normcase(f) not in foldmap)) | 403 if normcase(f) not in foldmap)) |
404 visit = set((f for f in notefiles if (f not in results and matchfn(f) | 404 visit = set((f for f in notefiles if (f not in results and matchfn(f) |
405 and (f in dmap or not ignore(f))))) | 405 and (f in dmap or not ignore(f))))) |
406 | 406 |
407 if nonnormalset is not None and not fresh_instance: | 407 if not fresh_instance: |
408 if matchalways: | 408 if matchalways: |
409 visit.update(f for f in nonnormalset if f not in results) | 409 visit.update(f for f in nonnormalset if f not in results) |
410 visit.update(f for f in copymap if f not in results) | 410 visit.update(f for f in copymap if f not in results) |
411 else: | 411 else: |
412 visit.update(f for f in nonnormalset | 412 visit.update(f for f in nonnormalset |
413 if f not in results and matchfn(f)) | 413 if f not in results and matchfn(f)) |
414 visit.update(f for f in copymap | 414 visit.update(f for f in copymap |
415 if f not in results and matchfn(f)) | 415 if f not in results and matchfn(f)) |
416 else: | 416 else: |
417 if matchalways: | 417 if matchalways: |
418 visit.update(f for f, st in dmap.iteritems() | 418 visit.update(f for f, st in dmap.iteritems() if f not in results) |
419 if (f not in results and | |
420 (st[2] < 0 or st[0] != 'n' or fresh_instance))) | |
421 visit.update(f for f in copymap if f not in results) | 419 visit.update(f for f in copymap if f not in results) |
422 else: | 420 else: |
423 visit.update(f for f, st in dmap.iteritems() | 421 visit.update(f for f, st in dmap.iteritems() |
424 if (f not in results and | 422 if f not in results and matchfn(f)) |
425 (st[2] < 0 or st[0] != 'n' or fresh_instance) | |
426 and matchfn(f))) | |
427 visit.update(f for f in copymap | 423 visit.update(f for f in copymap |
428 if f not in results and matchfn(f)) | 424 if f not in results and matchfn(f)) |
429 | 425 |
430 audit = pathutil.pathauditor(self._root, cached=True).check | 426 audit = pathutil.pathauditor(self._root, cached=True).check |
431 auditpass = [f for f in visit if audit(f)] | 427 auditpass = [f for f in visit if audit(f)] |