Mercurial > hg
changeset 47454:865c260d7163
revlog: add docket method to request new content files
If we want to write content into new files, we need to be able to ask for them.
Differential Revision: https://phab.mercurial-scm.org/D10867
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 29 May 2021 00:11:12 +0200 |
parents | c252631500e4 |
children | f93a867a6486 |
files | mercurial/revlogutils/docket.py |
diffstat | 1 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlogutils/docket.py Thu May 20 21:47:09 2021 +0200 +++ b/mercurial/revlogutils/docket.py Sat May 29 00:11:12 2021 +0200 @@ -173,6 +173,15 @@ self._index_uuid = make_uid() return b"%s-%s.idx" % (self._radix, self._index_uuid) + def new_index_file(self): + """switch index file to a new UID + + The previous index UID is moved to the "older" list.""" + old = (self._index_uuid, self._index_end) + self._older_index_uuids.insert(0, old) + self._index_uuid = make_uid() + return self.index_filepath() + def data_filepath(self): """file path to the current data file associated to this docket""" # very simplistic version at first @@ -180,6 +189,15 @@ self._data_uuid = make_uid() return b"%s-%s.dat" % (self._radix, self._data_uuid) + def new_data_file(self): + """switch data file to a new UID + + The previous data UID is moved to the "older" list.""" + old = (self._data_uuid, self._data_end) + self._older_data_uuids.insert(0, old) + self._data_uuid = make_uid() + return self.data_filepath() + def sidedata_filepath(self): """file path to the current sidedata file associated to this docket""" # very simplistic version at first @@ -187,6 +205,15 @@ self._sidedata_uuid = make_uid() return b"%s-%s.sda" % (self._radix, self._sidedata_uuid) + def new_sidedata_file(self): + """switch sidedata file to a new UID + + The previous sidedata UID is moved to the "older" list.""" + old = (self._sidedata_uuid, self._sidedata_end) + self._older_sidedata_uuids.insert(0, old) + self._sidedata_uuid = make_uid() + return self.sidedata_filepath() + @property def index_end(self): return self._index_end