Mercurial > hg
changeset 32229:75e93d95aae6
revlog: rename _chunkraw to _getsegmentforrevs()
This completes our rename of internal revlog methods to
distinguish between low-level raw revlog data "segments" and
higher-level, per-revision "chunks."
perf.py has been updated to consult both names so it will work
against older Mercurial versions.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 06 May 2017 12:12:53 -0700 |
parents | 112ba1c7d65d |
children | 73c3e226d2fc |
files | contrib/perf.py mercurial/debugcommands.py mercurial/revlog.py |
diffstat | 3 files changed, 20 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/perf.py Sat May 06 12:02:31 2017 -0700 +++ b/contrib/perf.py Sat May 06 12:12:53 2017 -0700 @@ -887,7 +887,12 @@ see ``perfrevlog`` and ``perfrevlogrevision``. """ rl = cmdutil.openrevlog(repo, 'perfrevlogchunks', file_, opts) - segmentforrevs = rl._chunkraw + + # _chunkraw was renamed to _getsegmentforrevs. + try: + segmentforrevs = rl._getsegmentforrevs + except AttributeError: + segmentforrevs = rl._chunkraw # Verify engines argument. if engines: @@ -1003,7 +1008,13 @@ raise error.CommandError('perfrevlogrevision', 'invalid arguments') r = cmdutil.openrevlog(repo, 'perfrevlogrevision', file_, opts) - segmentforrevs = r._chunkraw + + # _chunkraw was renamed to _getsegmentforrevs. + try: + segmentforrevs = r._getsegmentforrevs + except AttributeError: + segmentforrevs = r._chunkraw + node = r.lookup(rev) rev = r.rev(node)
--- a/mercurial/debugcommands.py Sat May 06 12:02:31 2017 -0700 +++ b/mercurial/debugcommands.py Sat May 06 12:12:53 2017 -0700 @@ -1707,9 +1707,9 @@ numother += 1 # Obtain data on the raw chunks in the revlog. - chunk = r._chunkraw(rev, rev)[1] - if chunk: - chunktype = chunk[0] + segment = r._getsegmentforrevs(rev, rev)[1] + if segment: + chunktype = segment[0] else: chunktype = 'empty'
--- a/mercurial/revlog.py Sat May 06 12:02:31 2017 -0700 +++ b/mercurial/revlog.py Sat May 06 12:12:53 2017 -0700 @@ -1147,7 +1147,7 @@ return self._readsegment(offset, length, df=df) - def _chunkraw(self, startrev, endrev, df=None): + def _getsegmentforrevs(self, startrev, endrev, df=None): """Obtain a segment of raw data corresponding to a range of revisions. Accepts the start and end revisions and an optional already-open @@ -1190,7 +1190,7 @@ Returns a str holding uncompressed data for the requested revision. """ - return self.decompress(self._chunkraw(rev, rev, df=df)[1]) + return self.decompress(self._getsegmentforrevs(rev, rev, df=df)[1]) def _chunks(self, revs, df=None): """Obtain decompressed chunks for the specified revisions. @@ -1217,7 +1217,7 @@ ladd = l.append try: - offset, data = self._chunkraw(revs[0], revs[-1], df=df) + offset, data = self._getsegmentforrevs(revs[0], revs[-1], df=df) except OverflowError: # issue4215 - we can't cache a run of chunks greater than # 2G on Windows @@ -1443,7 +1443,7 @@ df = self.opener(self.datafile, 'w') try: for r in self: - df.write(self._chunkraw(r, r)[1]) + df.write(self._getsegmentforrevs(r, r)[1]) finally: df.close()