Mercurial > hg-stable
comparison mercurial/revlog.py @ 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 | d7515d29761d |
children | ebac18733142 |
comparison
equal
deleted
inserted
replaced
47789:a11520e66ade | 47790:60ccc86a12f3 |
---|---|
2114 if inst.errno != errno.ENOENT: | 2114 if inst.errno != errno.ENOENT: |
2115 raise | 2115 raise |
2116 dfh = self._datafp(b"w+") | 2116 dfh = self._datafp(b"w+") |
2117 transaction.add(self._datafile, dsize) | 2117 transaction.add(self._datafile, dsize) |
2118 if self._sidedatafile is not None: | 2118 if self._sidedatafile is not None: |
2119 # revlog-v2 does not inline, help Pytype | |
2120 assert dfh is not None | |
2119 try: | 2121 try: |
2120 sdfh = self.opener(self._sidedatafile, mode=b"r+") | 2122 sdfh = self.opener(self._sidedatafile, mode=b"r+") |
2121 dfh.seek(self._docket.sidedata_end, os.SEEK_SET) | 2123 dfh.seek(self._docket.sidedata_end, os.SEEK_SET) |
2122 except IOError as inst: | 2124 except IOError as inst: |
2123 if inst.errno != errno.ENOENT: | 2125 if inst.errno != errno.ENOENT: |
2576 ifh.write(data[0]) | 2578 ifh.write(data[0]) |
2577 ifh.write(data[1]) | 2579 ifh.write(data[1]) |
2578 assert not sidedata | 2580 assert not sidedata |
2579 self._enforceinlinesize(transaction) | 2581 self._enforceinlinesize(transaction) |
2580 if self._docket is not None: | 2582 if self._docket is not None: |
2583 # revlog-v2 always has 3 writing handles, help Pytype | |
2584 assert self._writinghandles[2] is not None | |
2581 self._docket.index_end = self._writinghandles[0].tell() | 2585 self._docket.index_end = self._writinghandles[0].tell() |
2582 self._docket.data_end = self._writinghandles[1].tell() | 2586 self._docket.data_end = self._writinghandles[1].tell() |
2583 self._docket.sidedata_end = self._writinghandles[2].tell() | 2587 self._docket.sidedata_end = self._writinghandles[2].tell() |
2584 | 2588 |
2585 nodemaputil.setup_persistent_nodemap(transaction, self) | 2589 nodemaputil.setup_persistent_nodemap(transaction, self) |