~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/serializer/__init__.py

  • Committer: Hermann Kraus
  • Date: 2006-08-06 15:50:07 UTC
  • mto: (1711.2.121 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1918.
  • Revision ID: hermann@physiklaborant.de-20060806155007-9d2d684d8f04c084
Convert bundle errors from Exception to BzrNewError.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
            version = m.group('version')
54
54
            break
55
55
        elif line.startswith(BUNDLE_HEADER):
56
 
            raise errors.MalformedHeader()
 
56
            raise errors.MalformedHeader(
 
57
                'Extra characters after version number')
57
58
        m = CHANGESET_OLD_HEADER_RE.match(line)
58
59
        if m:
59
60
            version = m.group('version')
60
 
            raise errors.BundleNotSupported(version, 'old format bundles not supported')
 
61
            raise errors.BundleNotSupported(version, 
 
62
                'old format bundles not supported')
61
63
 
62
64
    if version is None:
63
65
        raise errors.NotABundle('Did not find an opening header')
64
66
 
65
67
    # Now we have a version, to figure out how to read the bundle 
66
68
    if not _serializers.has_key(version):
67
 
        raise errors.BundleNotSupported(version, 'version not listed in known versions')
 
69
        raise errors.BundleNotSupported(version, 
 
70
            'version not listed in known versions')
68
71
 
69
72
    serializer = _serializers[version](version)
70
73
 
185
188
    # parse it
186
189
    dot_loc = date.find('.')
187
190
    if dot_loc == -1:
188
 
        raise ValueError('Date string does not contain high-precision seconds: %r' % date)
 
191
        raise ValueError(
 
192
            'Date string does not contain high-precision seconds: %r' % date)
189
193
    base_time = time.strptime(date[:dot_loc], "%a %Y-%m-%d %H:%M:%S")
190
194
    fract_seconds, offset = date[dot_loc:].split()
191
195
    fract_seconds = float(fract_seconds)