Mercurial > hg-stable
changeset 32709:9933410bf763
obsstore: move marker version reading to a separate function
This allows us to read marker version without reading markers.
author | Jun Wu <quark@fb.com> |
---|---|
date | Fri, 02 Jun 2017 19:34:56 -0700 |
parents | 2c1400d43fd2 |
children | 3fad59faba8a |
files | mercurial/obsolete.py |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/obsolete.py Fri Jun 02 19:32:27 2017 -0700 +++ b/mercurial/obsolete.py Fri Jun 02 19:34:56 2017 -0700 @@ -439,12 +439,14 @@ formats = {_fm0version: (_fm0readmarkers, _fm0encodeonemarker), _fm1version: (_fm1readmarkers, _fm1encodeonemarker)} +def _readmarkerversion(data): + return _unpack('>B', data[0:1])[0] + @util.nogc def _readmarkers(data): """Read and enumerate markers from raw data""" - off = 0 - diskversion = _unpack('>B', data[off:off + 1])[0] - off += 1 + diskversion = _readmarkerversion(data) + off = 1 if diskversion not in formats: msg = _('parsing obsolete marker: unknown version %r') % diskversion raise error.UnknownVersion(msg, version=diskversion)