# HG changeset patch # User Pierre-Yves David # Date 2023-10-26 01:41:58 # Node ID 1c0f3994d7332be229dbaa383493dcc57560660b # Parent 222b892243970bde09ab9bea203f6352647d6a5c 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. diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -374,13 +374,17 @@ class changelog(revlog.revlog): 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 @@ class changelog(revlog.revlog): 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): diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -3019,7 +3019,7 @@ class localrepository: 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. diff --git a/mercurial/repoview.py b/mercurial/repoview.py --- a/mercurial/repoview.py +++ b/mercurial/repoview.py @@ -416,7 +416,7 @@ class repoview: 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 (