# HG changeset patch # User Mads Kiilerich # Date 1795729900 -3600 # Thu Nov 26 22:51:40 2026 +0100 # Branch testing # Node ID e77937ca1c9c96e3675178ed39f6fcfcbb2967cf # Parent c28e2b22465dc5dcb771fd88355609f185efbd78 vcs: Use LazyProperty on Repository._empty revisions is already cached, but make things a little bit faster by also caching the frequently used _empty property. diff --git a/kallithea/lib/vcs/backends/base.py b/kallithea/lib/vcs/backends/base.py --- a/kallithea/lib/vcs/backends/base.py +++ b/kallithea/lib/vcs/backends/base.py @@ -884,6 +884,10 @@ class BaseInMemoryChangeset(object): except AttributeError: pass try: + del self.repository._empty + except AttributeError: + pass + try: del self._commit_ctx except AttributeError: pass diff --git a/kallithea/lib/vcs/backends/git/repository.py b/kallithea/lib/vcs/backends/git/repository.py --- a/kallithea/lib/vcs/backends/git/repository.py +++ b/kallithea/lib/vcs/backends/git/repository.py @@ -83,7 +83,7 @@ class GitRepository(BaseRepository): except KeyError: return None - @property + @LazyProperty def _empty(self): """ Checks if repository is empty ie. without any changesets diff --git a/kallithea/lib/vcs/backends/hg/repository.py b/kallithea/lib/vcs/backends/hg/repository.py --- a/kallithea/lib/vcs/backends/hg/repository.py +++ b/kallithea/lib/vcs/backends/hg/repository.py @@ -86,7 +86,7 @@ class MercurialRepository(BaseRepository # We've set path and ui, now we can set _repo itself self._repo = self._get_repo(create, src_url, update_after_clone) - @property + @LazyProperty def _empty(self): """ Checks if repository is empty ie. without any changesets