##// END OF EJS Templates
obsolete: raise richer exception on unknown version...
marmoute -
r32591:19df975e default
parent child Browse files
Show More
@@ -138,6 +138,14 class UnsupportedMergeRecords(Abort):
138 hint=_('see https://mercurial-scm.org/wiki/MergeStateRecords for '
138 hint=_('see https://mercurial-scm.org/wiki/MergeStateRecords for '
139 'more information'))
139 'more information'))
140
140
141 class UnknownVersion(Abort):
142 """generic exception for aborting from an encounter with an unknown version
143 """
144
145 def __init__(self, msg, hint=None, version=None):
146 self.version = version
147 super(UnknownVersion, self).__init__(msg, hint=hint)
148
141 class LockError(IOError):
149 class LockError(IOError):
142 def __init__(self, errno, strerror, filename, desc):
150 def __init__(self, errno, strerror, filename, desc):
143 IOError.__init__(self, errno, strerror, filename)
151 IOError.__init__(self, errno, strerror, filename)
@@ -446,8 +446,8 def _readmarkers(data):
446 diskversion = _unpack('>B', data[off:off + 1])[0]
446 diskversion = _unpack('>B', data[off:off + 1])[0]
447 off += 1
447 off += 1
448 if diskversion not in formats:
448 if diskversion not in formats:
449 raise error.Abort(_('parsing obsolete marker: unknown version %r')
449 msg = _('parsing obsolete marker: unknown version %r') % diskversion
450 % diskversion)
450 raise error.UnknownVersion(msg, version=diskversion)
451 return diskversion, formats[diskversion][0](data, off)
451 return diskversion, formats[diskversion][0](data, off)
452
452
453 def encodemarkers(markers, addheader=False, version=_fm0version):
453 def encodemarkers(markers, addheader=False, version=_fm0version):
General Comments 0
You need to be logged in to leave comments. Login now