Mercurial > evolve
changeset 3393:a29d063d09e1
evolve: remove the old functions for writing evolvestate
Previous patch made all the users of these functions to use the evolvestate
class and now they are not required. Let's remove them.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 10 Jan 2018 15:59:35 +0530 |
parents | 62f33ed3c36c |
children | d1486760fb8d |
files | hgext3rd/evolve/__init__.py |
diffstat | 1 files changed, 0 insertions(+), 65 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py Wed Jan 10 15:57:43 2018 +0530 +++ b/hgext3rd/evolve/__init__.py Wed Jan 10 15:59:35 2018 +0530 @@ -257,7 +257,6 @@ import sys import re import collections -import errno import struct try: @@ -2484,70 +2483,6 @@ util.unlinkpath(repo.vfs.join('evolvestate'), ignoremissing=True) return ret -def _evolvestatewrite(repo, state): - # [version] - # [type][length][content] - # - # `version` is a 4 bytes integer (handled at higher level) - # `type` is a single character, `length` is a 4 byte integer, and - # `content` is an arbitrary byte sequence of length `length`. - f = repo.vfs('evolvestate', 'w') - try: - f.write(_pack('>I', evolvestateversion)) - current = state['current'] - key = 'C' # as in 'current' - format = '>sI%is' % len(current) - f.write(_pack(format, key, len(current), current)) - finally: - f.close() - -def _evolvestateread(repo): - try: - f = repo.vfs('evolvestate') - except IOError as err: - if err.errno != errno.ENOENT: - raise - return None - try: - versionblob = f.read(4) - if len(versionblob) < 4: - repo.ui.debug('ignoring corrupted evolvestate (file contains %i bits)' - % len(versionblob)) - return None - version = _unpack('>I', versionblob)[0] - if version != evolvestateversion: - msg = _('unknown evolvestate version %i') % version - raise error.Abort(msg, hint=_('upgrade your evolve')) - records = [] - data = f.read() - off = 0 - end = len(data) - while off < end: - rtype = data[off] - off += 1 - length = _unpack('>I', data[off:(off + 4)])[0] - off += 4 - record = data[off:(off + length)] - off += length - if rtype == 't': - rtype, record = record[0], record[1:] - records.append((rtype, record)) - state = {} - for rtype, rdata in records: - if rtype == 'C': - state['current'] = rdata - elif rtype.lower(): - repo.ui.debug('ignore evolve state record type %s' % rtype) - else: - raise error.Abort(_('unknown evolvestate field type %r') - % rtype, hint=_('upgrade your evolve')) - return state - finally: - f.close() - -def _evolvestatedelete(repo): - util.unlinkpath(repo.vfs.join('evolvestate'), ignoremissing=True) - def _evolvemerge(repo, orig, dest, pctx, keepbranch): """Used by the evolve function to merge dest on top of pctx. return the same tuple as merge.graft"""