[Updated] D11241: pytype: add assertions to explain revlogv2 invariants to Pytype

Alphare (Raphaël Gomès) phabricator at mercurial-scm.org
Tue Aug 3 02:11:35 UTC 2021


Closed by commit rHG60ccc86a12f3: pytype: add assertions to explain revlogv2 invariants to Pytype (authored by Alphare).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11241?vs=29773&id=29777

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11241/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D11241

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -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()



To: Alphare, #hg-reviewers, marmoute
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210803/853c97bd/attachment-0002.html>


More information about the Mercurial-patches mailing list