Mercurial > public > mercurial-scm > hg
comparison mercurial/revlogutils/randomaccessfile.py @ 51099:594f912818ab
changelog-delay: adds some check around delaying and diverting write
Theses assert shows we never call delay or divert if the revlog hold file handle
on the revlog's file.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 20 Oct 2023 12:13:33 +0200 |
parents | 3314c41c3759 |
children | 222b89224397 |
comparison
equal
deleted
inserted
replaced
51098:045b5f745f93 | 51099:594f912818ab |
---|---|
47 self._cached_chunk_position, self._cached_chunk = initial_cache | 47 self._cached_chunk_position, self._cached_chunk = initial_cache |
48 | 48 |
49 def clear_cache(self): | 49 def clear_cache(self): |
50 self._cached_chunk = b'' | 50 self._cached_chunk = b'' |
51 self._cached_chunk_position = 0 | 51 self._cached_chunk_position = 0 |
52 | |
53 @property | |
54 def is_open(self): | |
55 """True if any file handle is being held | |
56 | |
57 Used for assert and debug in the python code""" | |
58 return ( | |
59 self.reading_handle is not None or self.writing_handle is not None | |
60 ) | |
52 | 61 |
53 def _open(self, mode=b'r'): | 62 def _open(self, mode=b'r'): |
54 """Return a file object""" | 63 """Return a file object""" |
55 return self.opener(self.filename, mode=mode) | 64 return self.opener(self.filename, mode=mode) |
56 | 65 |