Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revlog.py @ 47250:682f09857d69
revlogv2: delay the update of the changelog docket to transaction end
This prevent external reader to see the transaction content before it is
commited. However this also prevent the hooks to see the transaction content.
We will fix this in later changesets.
We have to temporarily suppress the error output of the command ran during the
transaction as they sometimes get confused about unknown working directory and
sometimes issue message on std-err in unspecified order.
Differential Revision: https://phab.mercurial-scm.org/D10629
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 03 May 2021 12:35:02 +0200 |
parents | 6597255a4f94 |
children | 4f38ada3fc26 |
line wrap: on
line diff
--- a/mercurial/revlog.py Mon May 03 12:34:52 2021 +0200 +++ b/mercurial/revlog.py Mon May 03 12:35:02 2021 +0200 @@ -2096,7 +2096,7 @@ try: yield if self._docket is not None: - self._docket.write(transaction) + self._write_docket(transaction) finally: self._writinghandles = None finally: @@ -2105,6 +2105,15 @@ if dfh is not None: dfh.close() + def _write_docket(self, transaction): + """write the current docket on disk + + Exist as a method to help changelog to implement transaction logic + + We could also imagine using the same transaction logic for all revlog + since docket are cheap.""" + self._docket.write(transaction) + def addrevision( self, text, @@ -3187,18 +3196,6 @@ # Nothing to generate or remove return - # changelog implement some "delayed" writing mechanism that assume that - # all index data is writen in append mode and is therefor incompatible - # with the seeked write done in this method. The use of such "delayed" - # writing will soon be removed for revlog version that support side - # data, so for now, we only keep this simple assert to highlight the - # situation. - delayed = getattr(self, '_delayed', False) - diverted = getattr(self, '_divert', False) - if delayed and not diverted: - msg = "cannot rewrite_sidedata of a delayed revlog" - raise error.ProgrammingError(msg) - new_entries = [] # append the new sidedata with self._writing(transaction):