# Bazaar revision bundle v0.8 # # message: # Convert bundle errors from Exception to BzrNewError. # # committer: Hermann Kraus # date: Sun 2006-08-06 17:50:07.993999958 +0200 === modified file bzrlib/bundle/serializer/__init__.py --- bzrlib/bundle/serializer/__init__.py +++ bzrlib/bundle/serializer/__init__.py @@ -53,18 +53,21 @@ version = m.group('version') break elif line.startswith(BUNDLE_HEADER): - raise errors.MalformedHeader() + raise errors.MalformedHeader( + 'Extra characters after version number') m = CHANGESET_OLD_HEADER_RE.match(line) if m: version = m.group('version') - raise errors.BundleNotSupported(version, 'old format bundles not supported') + raise errors.BundleNotSupported(version, + 'old format bundles not supported') if version is None: raise errors.NotABundle('Did not find an opening header') # Now we have a version, to figure out how to read the bundle if not _serializers.has_key(version): - raise errors.BundleNotSupported(version, 'version not listed in known versions') + raise errors.BundleNotSupported(version, + 'version not listed in known versions') serializer = _serializers[version](version) @@ -185,7 +188,8 @@ # parse it dot_loc = date.find('.') if dot_loc == -1: - raise ValueError('Date string does not contain high-precision seconds: %r' % date) + raise ValueError( + 'Date string does not contain high-precision seconds: %r' % date) base_time = time.strptime(date[:dot_loc], "%a %Y-%m-%d %H:%M:%S") fract_seconds, offset = date[dot_loc:].split() fract_seconds = float(fract_seconds) === modified file bzrlib/errors.py --- bzrlib/errors.py +++ bzrlib/errors.py @@ -1045,16 +1045,37 @@ """Not a bzr revision-bundle: %(text)r""" def __init__(self, text): - self.text = text - - -class BadBundle(Exception): pass - - -class MalformedHeader(BadBundle): pass - - -class MalformedPatches(BadBundle): pass - - -class MalformedFooter(BadBundle): pass + BzrNewError.__init__(self) + self.text = text + + +class BadBundle(BzrNewError): + """Bad bzr revision-bundle: %(text)r""" + + def __init__(self, text): + BzrNewError.__init__(self) + self.text = text + + +class MalformedHeader(BadBundle): + """Malformed bzr revision-bundle header: %(text)r""" + + def __init__(self, text): + BzrNewError.__init__(self) + self.text = text + + +class MalformedPatches(BadBundle): + """Malformed patches in bzr revision-bundle: %(text)r""" + + def __init__(self, text): + BzrNewError.__init__(self) + self.text = text + + +class MalformedFooter(BadBundle): + """Malformed footer in bzr revision-bundle: %(text)r""" + + def __init__(self, text): + BzrNewError.__init__(self) + self.text = text \ No newline at end of file # revision id: hermann@physiklaborant.de-20060806155007-9d2d684d8f04c084 # sha1: 7c4d0a5670af70eda566c035eccef43671fa5325 # inventory sha1: e89dc397058d9aeaed4c9e3d5da5ba4d6e944370 # parent ids: # pqm@pqm.ubuntu.com-20060802020654-9d81db40bba14f69 # base id: pqm@pqm.ubuntu.com-20060802020654-9d81db40bba14f69 # properties: # branch-nick: bzr.dev