Mercurial > hg
comparison mercurial/revlogutils/docket.py @ 47455:f93a867a6486
revlog: list older-but-still-around file in `files`
These older files will eventually be removed, but we have to take them in account until they are. So we update `files` to keep fncache happy.
Differential Revision: https://phab.mercurial-scm.org/D10868
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 09 Jun 2021 19:47:29 +0200 |
parents | 865c260d7163 |
children | 6000f5b25c9b |
comparison
equal
deleted
inserted
replaced
47454:865c260d7163 | 47455:f93a867a6486 |
---|---|
180 old = (self._index_uuid, self._index_end) | 180 old = (self._index_uuid, self._index_end) |
181 self._older_index_uuids.insert(0, old) | 181 self._older_index_uuids.insert(0, old) |
182 self._index_uuid = make_uid() | 182 self._index_uuid = make_uid() |
183 return self.index_filepath() | 183 return self.index_filepath() |
184 | 184 |
185 def old_index_filepaths(self, include_empty=True): | |
186 """yield file path to older index files associated to this docket""" | |
187 # very simplistic version at first | |
188 for uuid, size in self._older_index_uuids: | |
189 if include_empty or size > 0: | |
190 yield b"%s-%s.idx" % (self._radix, uuid) | |
191 | |
185 def data_filepath(self): | 192 def data_filepath(self): |
186 """file path to the current data file associated to this docket""" | 193 """file path to the current data file associated to this docket""" |
187 # very simplistic version at first | 194 # very simplistic version at first |
188 if self._data_uuid is None: | 195 if self._data_uuid is None: |
189 self._data_uuid = make_uid() | 196 self._data_uuid = make_uid() |
196 old = (self._data_uuid, self._data_end) | 203 old = (self._data_uuid, self._data_end) |
197 self._older_data_uuids.insert(0, old) | 204 self._older_data_uuids.insert(0, old) |
198 self._data_uuid = make_uid() | 205 self._data_uuid = make_uid() |
199 return self.data_filepath() | 206 return self.data_filepath() |
200 | 207 |
208 def old_data_filepaths(self, include_empty=True): | |
209 """yield file path to older data files associated to this docket""" | |
210 # very simplistic version at first | |
211 for uuid, size in self._older_data_uuids: | |
212 if include_empty or size > 0: | |
213 yield b"%s-%s.dat" % (self._radix, uuid) | |
214 | |
201 def sidedata_filepath(self): | 215 def sidedata_filepath(self): |
202 """file path to the current sidedata file associated to this docket""" | 216 """file path to the current sidedata file associated to this docket""" |
203 # very simplistic version at first | 217 # very simplistic version at first |
204 if self._sidedata_uuid is None: | 218 if self._sidedata_uuid is None: |
205 self._sidedata_uuid = make_uid() | 219 self._sidedata_uuid = make_uid() |
211 The previous sidedata UID is moved to the "older" list.""" | 225 The previous sidedata UID is moved to the "older" list.""" |
212 old = (self._sidedata_uuid, self._sidedata_end) | 226 old = (self._sidedata_uuid, self._sidedata_end) |
213 self._older_sidedata_uuids.insert(0, old) | 227 self._older_sidedata_uuids.insert(0, old) |
214 self._sidedata_uuid = make_uid() | 228 self._sidedata_uuid = make_uid() |
215 return self.sidedata_filepath() | 229 return self.sidedata_filepath() |
230 | |
231 def old_sidedata_filepaths(self, include_empty=True): | |
232 """yield file path to older sidedata files associated to this docket""" | |
233 # very simplistic version at first | |
234 for uuid, size in self._older_sidedata_uuids: | |
235 if include_empty or size > 0: | |
236 yield b"%s-%s.sda" % (self._radix, uuid) | |
216 | 237 |
217 @property | 238 @property |
218 def index_end(self): | 239 def index_end(self): |
219 return self._index_end | 240 return self._index_end |
220 | 241 |