--- a/mercurial/revlog.py Thu Jan 20 14:02:58 2022 +0000
+++ b/mercurial/revlog.py Thu Jan 20 14:06:36 2022 +0000
@@ -2006,7 +2006,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
@@ -2029,10 +2029,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