Mercurial > hg-stable
changeset 51108:1c0f3994d733
changelog-delay: move "delayed" check to a more official API
To avoid reaching inside the inner object in the future, we needs some official
API. We put one of such API early to reduce the size of the final diff.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 26 Oct 2023 03:41:58 +0200 |
parents | 222b89224397 |
children | af96fbb8f739 |
files | mercurial/changelog.py mercurial/localrepo.py mercurial/repoview.py |
diffstat | 3 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changelog.py Thu Oct 26 03:29:46 2023 +0200 +++ b/mercurial/changelog.py Thu Oct 26 03:41:58 2023 +0200 @@ -374,13 +374,17 @@ self._filteredrevs_hashcache = {} def _write_docket(self, tr): - if not self._delayed: + if not self.is_delaying: super(changelog, self)._write_docket(tr) + @property + def is_delaying(self): + return self._delayed + def delayupdate(self, tr): """delay visibility of index updates to other readers""" assert not self._inner.is_open - if self._docket is None and not self._delayed: + if self._docket is None and not self.is_delaying: if len(self) == 0: self._divert = True if self._realopener.exists(self._indexfile + b'.a'): @@ -456,7 +460,7 @@ return False def _enforceinlinesize(self, tr, side_write=True): - if not self._delayed: + if not self.is_delaying: revlog.revlog._enforceinlinesize(self, tr, side_write=side_write) def read(self, nodeorrev):
--- a/mercurial/localrepo.py Thu Oct 26 03:29:46 2023 +0200 +++ b/mercurial/localrepo.py Thu Oct 26 03:41:58 2023 +0200 @@ -3019,7 +3019,7 @@ if ( k == b'changelog' and self.currenttransaction() - and self.changelog._delayed + and self.changelog.is_delaying ): # The changelog object may store unwritten revisions. We don't # want to lose them.
--- a/mercurial/repoview.py Thu Oct 26 03:29:46 2023 +0200 +++ b/mercurial/repoview.py Thu Oct 26 03:41:58 2023 +0200 @@ -416,7 +416,7 @@ with util.timedcm('repo filter for %s', self.filtername): revs = filterrevs(unfi, self.filtername, self._visibilityexceptions) cl = self._clcache - newkey = (unfilen, unfinode, hash(revs), unfichangelog._delayed) + newkey = (unfilen, unfinode, hash(revs), unfichangelog.is_delaying) # if cl.index is not unfiindex, unfi.changelog would be # recreated, and our clcache refers to garbage object if cl is not None and (