changeset 47790:60ccc86a12f3 stable

pytype: add assertions to explain revlogv2 invariants to Pytype Differential Revision: https://phab.mercurial-scm.org/D11241
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 02 Aug 2021 16:21:54 +0200
parents a11520e66ade
children 6c86f96042c9
files mercurial/revlog.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Fri Jul 30 00:11:56 2021 -0400
+++ b/mercurial/revlog.py	Mon Aug 02 16:21:54 2021 +0200
@@ -2116,6 +2116,8 @@
                         dfh = self._datafp(b"w+")
                     transaction.add(self._datafile, dsize)
                 if self._sidedatafile is not None:
+                    # revlog-v2 does not inline, help Pytype
+                    assert dfh is not None
                     try:
                         sdfh = self.opener(self._sidedatafile, mode=b"r+")
                         dfh.seek(self._docket.sidedata_end, os.SEEK_SET)
@@ -2578,6 +2580,8 @@
             assert not sidedata
             self._enforceinlinesize(transaction)
         if self._docket is not None:
+            # revlog-v2 always has 3 writing handles, help Pytype
+            assert self._writinghandles[2] is not None
             self._docket.index_end = self._writinghandles[0].tell()
             self._docket.data_end = self._writinghandles[1].tell()
             self._docket.sidedata_end = self._writinghandles[2].tell()