##// END OF EJS Templates
revlog: drop more file description passing between private function...
marmoute -
r51919:8520db30 default
parent child Browse files
Show More
@@ -117,7 +117,7 b' class bundlerevlog(revlog.revlog):'
117 with super().reading() as x:
117 with super().reading() as x:
118 yield x
118 yield x
119
119
120 def _chunk(self, rev, df=None):
120 def _chunk(self, rev):
121 # Warning: in case of bundle, the diff is against what we stored as
121 # Warning: in case of bundle, the diff is against what we stored as
122 # delta base, not against rev - 1
122 # delta base, not against rev - 1
123 # XXX: could use some caching
123 # XXX: could use some caching
@@ -138,7 +138,7 b' class bundlerevlog(revlog.revlog):'
138
138
139 return mdiff.textdiff(self.rawdata(rev1), self.rawdata(rev2))
139 return mdiff.textdiff(self.rawdata(rev1), self.rawdata(rev2))
140
140
141 def _rawtext(self, node, rev, _df=None):
141 def _rawtext(self, node, rev):
142 if rev is None:
142 if rev is None:
143 rev = self.rev(node)
143 rev = self.rev(node)
144 validated = False
144 validated = False
@@ -156,7 +156,8 b' class bundlerevlog(revlog.revlog):'
156 rawtext = b''
156 rawtext = b''
157 elif rawtext is None:
157 elif rawtext is None:
158 r = super(bundlerevlog, self)._rawtext(
158 r = super(bundlerevlog, self)._rawtext(
159 self.node(iterrev), iterrev, _df=_df
159 self.node(iterrev),
160 iterrev,
160 )
161 )
161 __, rawtext, validated = r
162 __, rawtext, validated = r
162 if chain:
163 if chain:
@@ -1771,7 +1771,7 b' class revlog:'
1771 p1, p2 = self.parents(node)
1771 p1, p2 = self.parents(node)
1772 return storageutil.hashrevisionsha1(text, p1, p2) != node
1772 return storageutil.hashrevisionsha1(text, p1, p2) != node
1773
1773
1774 def _getsegmentforrevs(self, startrev, endrev, df=None):
1774 def _getsegmentforrevs(self, startrev, endrev):
1775 """Obtain a segment of raw data corresponding to a range of revisions.
1775 """Obtain a segment of raw data corresponding to a range of revisions.
1776
1776
1777 Accepts the start and end revisions and an optional already-open
1777 Accepts the start and end revisions and an optional already-open
@@ -1803,9 +1803,9 b' class revlog:'
1803 end += (endrev + 1) * self.index.entry_size
1803 end += (endrev + 1) * self.index.entry_size
1804 length = end - start
1804 length = end - start
1805
1805
1806 return start, self._segmentfile.read_chunk(start, length, df)
1806 return start, self._segmentfile.read_chunk(start, length)
1807
1807
1808 def _chunk(self, rev, df=None):
1808 def _chunk(self, rev):
1809 """Obtain a single decompressed chunk for a revision.
1809 """Obtain a single decompressed chunk for a revision.
1810
1810
1811 Accepts an integer revision and an optional already-open file handle
1811 Accepts an integer revision and an optional already-open file handle
@@ -1815,7 +1815,7 b' class revlog:'
1815 Returns a str holding uncompressed data for the requested revision.
1815 Returns a str holding uncompressed data for the requested revision.
1816 """
1816 """
1817 compression_mode = self.index[rev][10]
1817 compression_mode = self.index[rev][10]
1818 data = self._getsegmentforrevs(rev, rev, df=df)[1]
1818 data = self._getsegmentforrevs(rev, rev)[1]
1819 if compression_mode == COMP_MODE_PLAIN:
1819 if compression_mode == COMP_MODE_PLAIN:
1820 return data
1820 return data
1821 elif compression_mode == COMP_MODE_DEFAULT:
1821 elif compression_mode == COMP_MODE_DEFAULT:
@@ -1827,7 +1827,7 b' class revlog:'
1827 msg %= compression_mode
1827 msg %= compression_mode
1828 raise error.RevlogError(msg)
1828 raise error.RevlogError(msg)
1829
1829
1830 def _chunks(self, revs, df=None, targetsize=None):
1830 def _chunks(self, revs, targetsize=None):
1831 """Obtain decompressed chunks for the specified revisions.
1831 """Obtain decompressed chunks for the specified revisions.
1832
1832
1833 Accepts an iterable of numeric revisions that are assumed to be in
1833 Accepts an iterable of numeric revisions that are assumed to be in
@@ -1866,11 +1866,11 b' class revlog:'
1866 break
1866 break
1867
1867
1868 try:
1868 try:
1869 offset, data = self._getsegmentforrevs(firstrev, lastrev, df=df)
1869 offset, data = self._getsegmentforrevs(firstrev, lastrev)
1870 except OverflowError:
1870 except OverflowError:
1871 # issue4215 - we can't cache a run of chunks greater than
1871 # issue4215 - we can't cache a run of chunks greater than
1872 # 2G on Windows
1872 # 2G on Windows
1873 return [self._chunk(rev, df=df) for rev in revschunk]
1873 return [self._chunk(rev) for rev in revschunk]
1874
1874
1875 decomp = self.decompress
1875 decomp = self.decompress
1876 # self._decompressor might be None, but will not be used in that case
1876 # self._decompressor might be None, but will not be used in that case
@@ -1974,7 +1974,7 b' class revlog:'
1974 rev = self.rev(nodeorrev)
1974 rev = self.rev(nodeorrev)
1975 return self._sidedata(rev)
1975 return self._sidedata(rev)
1976
1976
1977 def _revisiondata(self, nodeorrev, _df=None, raw=False):
1977 def _revisiondata(self, nodeorrev, raw=False):
1978 # deal with <nodeorrev> argument type
1978 # deal with <nodeorrev> argument type
1979 if isinstance(nodeorrev, int):
1979 if isinstance(nodeorrev, int):
1980 rev = nodeorrev
1980 rev = nodeorrev
@@ -1989,7 +1989,7 b' class revlog:'
1989
1989
1990 # ``rawtext`` is the text as stored inside the revlog. Might be the
1990 # ``rawtext`` is the text as stored inside the revlog. Might be the
1991 # revision or might need to be processed to retrieve the revision.
1991 # revision or might need to be processed to retrieve the revision.
1992 rev, rawtext, validated = self._rawtext(node, rev, _df=_df)
1992 rev, rawtext, validated = self._rawtext(node, rev)
1993
1993
1994 if raw and validated:
1994 if raw and validated:
1995 # if we don't want to process the raw text and that raw
1995 # if we don't want to process the raw text and that raw
@@ -2018,7 +2018,7 b' class revlog:'
2018
2018
2019 return text
2019 return text
2020
2020
2021 def _rawtext(self, node, rev, _df=None):
2021 def _rawtext(self, node, rev):
2022 """return the possibly unvalidated rawtext for a revision
2022 """return the possibly unvalidated rawtext for a revision
2023
2023
2024 returns (rev, rawtext, validated)
2024 returns (rev, rawtext, validated)
@@ -2052,7 +2052,7 b' class revlog:'
2052 if 0 <= rawsize:
2052 if 0 <= rawsize:
2053 targetsize = 4 * rawsize
2053 targetsize = 4 * rawsize
2054
2054
2055 bins = self._chunks(chain, df=_df, targetsize=targetsize)
2055 bins = self._chunks(chain, targetsize=targetsize)
2056 if basetext is None:
2056 if basetext is None:
2057 basetext = bytes(bins[0])
2057 basetext = bytes(bins[0])
2058 bins = bins[1:]
2058 bins = bins[1:]
@@ -127,7 +127,7 b' class unionrevlog(revlog.revlog):'
127 with read_1(), read_2():
127 with read_1(), read_2():
128 yield
128 yield
129
129
130 def _chunk(self, rev, df=None):
130 def _chunk(self, rev):
131 if rev <= self.repotiprev:
131 if rev <= self.repotiprev:
132 return revlog.revlog._chunk(self, rev)
132 return revlog.revlog._chunk(self, rev)
133 return self.revlog2._chunk(self.node(rev))
133 return self.revlog2._chunk(self.node(rev))
@@ -144,7 +144,7 b' class unionrevlog(revlog.revlog):'
144
144
145 return mdiff.textdiff(self.rawdata(rev1), self.rawdata(rev2))
145 return mdiff.textdiff(self.rawdata(rev1), self.rawdata(rev2))
146
146
147 def _revisiondata(self, nodeorrev, _df=None, raw=False):
147 def _revisiondata(self, nodeorrev, raw=False):
148 if isinstance(nodeorrev, int):
148 if isinstance(nodeorrev, int):
149 rev = nodeorrev
149 rev = nodeorrev
150 node = self.node(rev)
150 node = self.node(rev)
@@ -158,7 +158,7 b' class unionrevlog(revlog.revlog):'
158 func = revlog2._revisiondata
158 func = revlog2._revisiondata
159 else:
159 else:
160 func = super(unionrevlog, self)._revisiondata
160 func = super(unionrevlog, self)._revisiondata
161 return func(node, _df=_df, raw=raw)
161 return func(node, raw=raw)
162
162
163 def addrevision(
163 def addrevision(
164 self,
164 self,
General Comments 0
You need to be logged in to leave comments. Login now