comparison hgext/fsmonitor/__init__.py @ 44452:9d2b2df2c2ba

cleanup: run pyupgrade on our source tree to clean up varying things Built with: hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**' | xargs pyupgrade --keep-percent-format --keep-extraneous-parens and then blackened. pyupgrade comes from https://github.com/asottile/pyupgrade with a patch to let me preserve extraneous parens (which we use for marking strings that shouldn't be translated), and lets us clean up a bunch of idioms that have cruftily accumulated over the years. # skip-blame no-op automated code cleanups Differential Revision: https://phab.mercurial-scm.org/D8255
author Augie Fackler <augie@google.com>
date Fri, 06 Mar 2020 13:27:41 -0500
parents 2d49482d0dd4
children 017cc5ee537f
comparison
equal deleted inserted replaced
44449:ff72bd52d56a 44452:9d2b2df2c2ba
395 notefiles = [] 395 notefiles = []
396 396
397 # for file paths which require normalization and we encounter a case 397 # for file paths which require normalization and we encounter a case
398 # collision, we store our own foldmap 398 # collision, we store our own foldmap
399 if normalize: 399 if normalize:
400 foldmap = dict((normcase(k), k) for k in results) 400 foldmap = {normcase(k): k for k in results}
401 401
402 switch_slashes = pycompat.ossep == b'\\' 402 switch_slashes = pycompat.ossep == b'\\'
403 # The order of the results is, strictly speaking, undefined. 403 # The order of the results is, strictly speaking, undefined.
404 # For case changes on a case insensitive filesystem we may receive 404 # For case changes on a case insensitive filesystem we may receive
405 # two entries, one with exists=True and another with exists=False. 405 # two entries, one with exists=True and another with exists=False.
457 # step 3: query notable files we don't already know about 457 # step 3: query notable files we don't already know about
458 # XXX try not to iterate over the entire dmap 458 # XXX try not to iterate over the entire dmap
459 if normalize: 459 if normalize:
460 # any notable files that have changed case will already be handled 460 # any notable files that have changed case will already be handled
461 # above, so just check membership in the foldmap 461 # above, so just check membership in the foldmap
462 notefiles = set( 462 notefiles = {
463 ( 463 normalize(f, True, True)
464 normalize(f, True, True)
465 for f in notefiles
466 if normcase(f) not in foldmap
467 )
468 )
469 visit = set(
470 (
471 f
472 for f in notefiles 464 for f in notefiles
473 if ( 465 if normcase(f) not in foldmap
474 f not in results and matchfn(f) and (f in dmap or not ignore(f)) 466 }
475 ) 467 visit = {
476 ) 468 f
477 ) 469 for f in notefiles
470 if (f not in results and matchfn(f) and (f in dmap or not ignore(f)))
471 }
478 472
479 if not fresh_instance: 473 if not fresh_instance:
480 if matchalways: 474 if matchalways:
481 visit.update(f for f in nonnormalset if f not in results) 475 visit.update(f for f in nonnormalset if f not in results)
482 visit.update(f for f in copymap if f not in results) 476 visit.update(f for f in copymap if f not in results)