# HG changeset patch # User Pierre-Yves David # Date 1698284518 -7200 # 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 -r 222b89224397 -r 1c0f3994d733 mercurial/changelog.py --- 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): diff -r 222b89224397 -r 1c0f3994d733 mercurial/localrepo.py --- 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. diff -r 222b89224397 -r 1c0f3994d733 mercurial/repoview.py --- 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 (