Mercurial > hg
changeset 47218:b3acefded601
revlog: use `_writing` in `rewrite_sidedata`
Special cases aren't special enough to break the rules.
Differential Revision: https://phab.mercurial-scm.org/D10609
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 03 May 2021 12:28:26 +0200 |
parents | 8f6165c90163 |
children | ffa8afc5f931 |
files | mercurial/revlog.py |
diffstat | 1 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Mon May 03 12:28:15 2021 +0200 +++ b/mercurial/revlog.py Mon May 03 12:28:26 2021 +0200 @@ -3157,8 +3157,8 @@ new_entries = [] # append the new sidedata - with self._datafp(b'a+') as dfh: - # Maybe this bug still exists, see revlog._writeentry + with self._writing(transaction): + ifh, dfh = self._writinghandles dfh.seek(0, os.SEEK_END) current_offset = dfh.tell() for rev in range(startrev, endrev + 1): @@ -3192,9 +3192,8 @@ new_entries.append(entry) current_offset += len(serialized_sidedata) - # rewrite the new index entries - with self._indexfp(b'r+') as ifh: - fp.seek(startrev * self.index.entry_size) + # rewrite the new index entries + ifh.seek(startrev * self.index.entry_size) for i, e in enumerate(new_entries): rev = startrev + i self.index.replace_sidedata_info(rev, e[8], e[9], e[0])