Details
Details
- Reviewers
indygreg Alphare - Group Reviewers
hg-reviewers - Commits
- rHG5fbac82a8780: revlog: byteify a few error strings
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
indygreg | |
Alphare |
hg-reviewers |
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/revlog.py (6 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
0749985291d4 | 9424bfb87a2e | Matt Harbison | Jun 12 2021, 12:51 AM |
Status | Author | Revision | |
---|---|---|---|
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 |
data = self._getsegmentforrevs(rev, rev, df=df)[1] | data = self._getsegmentforrevs(rev, rev, df=df)[1] | ||||
if compression_mode == COMP_MODE_PLAIN: | if compression_mode == COMP_MODE_PLAIN: | ||||
return data | return data | ||||
elif compression_mode == COMP_MODE_DEFAULT: | elif compression_mode == COMP_MODE_DEFAULT: | ||||
return self._decompressor(data) | return self._decompressor(data) | ||||
elif compression_mode == COMP_MODE_INLINE: | elif compression_mode == COMP_MODE_INLINE: | ||||
return self.decompress(data) | return self.decompress(data) | ||||
else: | else: | ||||
msg = 'unknown compression mode %d' | msg = b'unknown compression mode %d' | ||||
msg %= compression_mode | msg %= compression_mode | ||||
raise error.RevlogError(msg) | raise error.RevlogError(msg) | ||||
def _chunks(self, revs, df=None, targetsize=None): | def _chunks(self, revs, df=None, targetsize=None): | ||||
"""Obtain decompressed chunks for the specified revisions. | """Obtain decompressed chunks for the specified revisions. | ||||
Accepts an iterable of numeric revisions that are assumed to be in | Accepts an iterable of numeric revisions that are assumed to be in | ||||
ascending order. Also accepts an optional already-open file handle | ascending order. Also accepts an optional already-open file handle | ||||
c = buffer(data, chunkstart - offset, chunklength) | c = buffer(data, chunkstart - offset, chunklength) | ||||
if comp_mode == COMP_MODE_PLAIN: | if comp_mode == COMP_MODE_PLAIN: | ||||
ladd(c) | ladd(c) | ||||
elif comp_mode == COMP_MODE_INLINE: | elif comp_mode == COMP_MODE_INLINE: | ||||
ladd(decomp(c)) | ladd(decomp(c)) | ||||
elif comp_mode == COMP_MODE_DEFAULT: | elif comp_mode == COMP_MODE_DEFAULT: | ||||
ladd(def_decomp(c)) | ladd(def_decomp(c)) | ||||
else: | else: | ||||
msg = 'unknown compression mode %d' | msg = b'unknown compression mode %d' | ||||
msg %= comp_mode | msg %= comp_mode | ||||
raise error.RevlogError(msg) | raise error.RevlogError(msg) | ||||
return l | return l | ||||
def _chunkclear(self): | def _chunkclear(self): | ||||
"""Clear the raw chunk cache.""" | """Clear the raw chunk cache.""" | ||||
self._chunkcache = (0, b'') | self._chunkcache = (0, b'') | ||||
comp = self.index[rev][11] | comp = self.index[rev][11] | ||||
if comp == COMP_MODE_PLAIN: | if comp == COMP_MODE_PLAIN: | ||||
segment = comp_segment | segment = comp_segment | ||||
elif comp == COMP_MODE_DEFAULT: | elif comp == COMP_MODE_DEFAULT: | ||||
segment = self._decompressor(comp_segment) | segment = self._decompressor(comp_segment) | ||||
elif comp == COMP_MODE_INLINE: | elif comp == COMP_MODE_INLINE: | ||||
segment = self.decompress(comp_segment) | segment = self.decompress(comp_segment) | ||||
else: | else: | ||||
msg = 'unknown compression mode %d' | msg = b'unknown compression mode %d' | ||||
msg %= comp | msg %= comp | ||||
raise error.RevlogError(msg) | raise error.RevlogError(msg) | ||||
sidedata = sidedatautil.deserialize_sidedata(segment) | sidedata = sidedatautil.deserialize_sidedata(segment) | ||||
return sidedata | return sidedata | ||||
def rawdata(self, nodeorrev, _df=None): | def rawdata(self, nodeorrev, _df=None): | ||||
"""return an uncompressed raw data of a given node or revision number. | """return an uncompressed raw data of a given node or revision number. |