Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 46506:07984507d553
revlog: change _addrevision to return the new revision
The node is passed as argument already, so returning it is quite
pointless. The revision number on the other is useful as it decouples
the caller from the revlog internals.
Differential Revision: https://phab.mercurial-scm.org/D9880
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Tue, 26 Jan 2021 23:56:11 +0100 |
parents | 835aafb2543f |
children | 9ee4e988e2be |
comparison
equal
deleted
inserted
replaced
46505:a25033eb43b5 | 46506:07984507d553 |
---|---|
2143 dfh = None | 2143 dfh = None |
2144 if not self._inline: | 2144 if not self._inline: |
2145 dfh = self._datafp(b"a+") | 2145 dfh = self._datafp(b"a+") |
2146 ifh = self._indexfp(b"a+") | 2146 ifh = self._indexfp(b"a+") |
2147 try: | 2147 try: |
2148 return self._addrevision( | 2148 self._addrevision( |
2149 node, | 2149 node, |
2150 rawtext, | 2150 rawtext, |
2151 transaction, | 2151 transaction, |
2152 link, | 2152 link, |
2153 p1, | 2153 p1, |
2156 cachedelta, | 2156 cachedelta, |
2157 ifh, | 2157 ifh, |
2158 dfh, | 2158 dfh, |
2159 deltacomputer=deltacomputer, | 2159 deltacomputer=deltacomputer, |
2160 ) | 2160 ) |
2161 return node | |
2161 finally: | 2162 finally: |
2162 if dfh: | 2163 if dfh: |
2163 dfh.close() | 2164 dfh.close() |
2164 ifh.close() | 2165 ifh.close() |
2165 | 2166 |
2327 rawtext = deltacomputer.buildtext(revinfo, fh) | 2328 rawtext = deltacomputer.buildtext(revinfo, fh) |
2328 | 2329 |
2329 if type(rawtext) == bytes: # only accept immutable objects | 2330 if type(rawtext) == bytes: # only accept immutable objects |
2330 self._revisioncache = (node, curr, rawtext) | 2331 self._revisioncache = (node, curr, rawtext) |
2331 self._chainbasecache[curr] = deltainfo.chainbase | 2332 self._chainbasecache[curr] = deltainfo.chainbase |
2332 return node | 2333 return curr |
2333 | 2334 |
2334 def _writeentry(self, transaction, ifh, dfh, entry, data, link, offset): | 2335 def _writeentry(self, transaction, ifh, dfh, entry, data, link, offset): |
2335 # Files opened in a+ mode have inconsistent behavior on various | 2336 # Files opened in a+ mode have inconsistent behavior on various |
2336 # platforms. Windows requires that a file positioning call be made | 2337 # platforms. Windows requires that a file positioning call be made |
2337 # when the file handle transitions between reads and writes. See | 2338 # when the file handle transitions between reads and writes. See |