Mercurial > public > mercurial-scm > hg-stable
diff mercurial/repocache.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | dcac24ec935b |
children | 687b865b95ad |
line wrap: on
line diff
--- a/mercurial/repocache.py Sat Oct 05 10:29:34 2019 -0400 +++ b/mercurial/repocache.py Sun Oct 06 09:45:02 2019 -0400 @@ -19,6 +19,7 @@ util, ) + class repoloader(object): """Load repositories in background thread @@ -68,8 +69,9 @@ loader thread. """ if self._thread and self._thread.is_alive(): - raise error.ProgrammingError(b'cannot obtain cached repo while ' - b'loader is active') + raise error.ProgrammingError( + b'cannot obtain cached repo while ' b'loader is active' + ) return self._cache.peek(path, None) def _mainloop(self): @@ -99,10 +101,15 @@ except KeyError: repo = hg.repository(self._ui, path).unfiltered() _warmupcache(repo) - repo.ui.log(b'repocache', b'loaded repo into cache: %s (in %.3fs)\n', - path, util.timer() - start) + repo.ui.log( + b'repocache', + b'loaded repo into cache: %s (in %.3fs)\n', + path, + util.timer() - start, + ) self._cache.insert(path, repo) + # TODO: think about proper API of preloading cache def _warmupcache(repo): repo.invalidateall() @@ -115,6 +122,7 @@ obsolete.getrevs(repo, name) repo._phasecache.loadphaserevs(repo) + # TODO: think about proper API of attaching preloaded attributes def copycache(srcrepo, destrepo): """Copy cached attributes from srcrepo to destrepo"""