comparison hgext/remotefilelog/basepack.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 59fa3890d40a
comparison
equal deleted inserted replaced
44449:ff72bd52d56a 44452:9d2b2df2c2ba
99 # Cache iteration is based on LRU. 99 # Cache iteration is based on LRU.
100 for pack in self._lrucache: 100 for pack in self._lrucache:
101 self._lastpack = pack 101 self._lastpack = pack
102 yield pack 102 yield pack
103 103
104 cachedpacks = set(pack for pack in self._lrucache) 104 cachedpacks = {pack for pack in self._lrucache}
105 # Yield for paths not in the cache. 105 # Yield for paths not in the cache.
106 for pack in self._packs - cachedpacks: 106 for pack in self._packs - cachedpacks:
107 self._lastpack = pack 107 self._lastpack = pack
108 yield pack 108 yield pack
109 109
257 # repack is going on in the background, and that should be pretty rare 257 # repack is going on in the background, and that should be pretty rare
258 # to have that happen twice in quick succession. 258 # to have that happen twice in quick succession.
259 newpacks = [] 259 newpacks = []
260 if now > self.lastrefresh + REFRESHRATE: 260 if now > self.lastrefresh + REFRESHRATE:
261 self.lastrefresh = now 261 self.lastrefresh = now
262 previous = set(p.path for p in self.packs) 262 previous = {p.path for p in self.packs}
263 for filepath, __, __ in self._getavailablepackfilessorted(): 263 for filepath, __, __ in self._getavailablepackfilessorted():
264 if filepath not in previous: 264 if filepath not in previous:
265 newpack = self.getpack(filepath) 265 newpack = self.getpack(filepath)
266 newpacks.append(newpack) 266 newpacks.append(newpack)
267 self.packs.add(newpack) 267 self.packs.add(newpack)