--- a/mercurial/revlog.py Wed Jan 26 15:32:18 2022 -0800
+++ b/mercurial/revlog.py Wed Feb 02 17:24:05 2022 +0100
@@ -1971,7 +1971,7 @@
raise error.RevlogError(
_(b"%s not found in the transaction") % self._indexfile
)
- trindex = 0
+ trindex = None
tr.add(self._datafile, 0)
existing_handles = False
@@ -1994,10 +1994,17 @@
with self._indexfp() as read_ifh:
for r in self:
new_dfh.write(self._getsegmentforrevs(r, r, df=read_ifh)[1])
- if troffset <= self.start(r) + r * self.index.entry_size:
+ if (
+ trindex is None
+ and troffset
+ <= self.start(r) + r * self.index.entry_size
+ ):
trindex = r
new_dfh.flush()
+ if trindex is None:
+ trindex = 0
+
with self.__index_new_fp() as fp:
self._format_flags &= ~FLAG_INLINE_DATA
self._inline = False