/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2006-09-15 00:44:57 UTC
  • mfrom: (2009 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2050.
  • Revision ID: john@arbash-meinel.com-20060915004457-902cec0526a39337
[merge] bzr.dev 2009

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 
38
38
 
39
39
def _get_filename(f):
40
 
    if hasattr(f, 'name'):
41
 
        return f.name
42
 
    return '<unknown>'
 
40
    return getattr(f, 'name', '<unknown>')
43
41
 
44
42
 
45
43
def read_bundle(f):
69
67
        raise errors.NotABundle('Did not find an opening header')
70
68
 
71
69
    # Now we have a version, to figure out how to read the bundle 
72
 
    if not _serializers.has_key(version):
 
70
    if version not in _serializers:
73
71
        raise errors.BundleNotSupported(version, 
74
72
            'version not listed in known versions')
75
73
 
87
85
    :param version: [optional] target serialization version
88
86
    """
89
87
 
90
 
    if not _serializers.has_key(version):
 
88
    if version not in _serializers:
91
89
        raise errors.BundleNotSupported(version, 'unknown bundle format')
92
90
 
93
91
    serializer = _serializers[version](version)
108
106
 
109
107
 
110
108
def _write_bundle(repository, revision_id, base_revision_id, out):
 
109
    """Write a bundle of revisions.
 
110
 
 
111
    :param repository: Repository containing revisions to serialize.
 
112
    :param revision_id: Head revision_id of the bundle.
 
113
    :param base_revision_id: Revision assumed to be present in repositories
 
114
         applying the bundle.
 
115
    :param out: Output file.
 
116
    """
111
117
    if base_revision_id is NULL_REVISION:
112
118
        base_revision_id = None
113
119
    base_ancestry = set(repository.get_ancestry(base_revision_id))
151
157
    
152
158
    # This has to be formatted for "original" date, so that the
153
159
    # revision XML entry will be reproduced faithfully.
154
 
    if offset == None:
 
160
    if offset is None:
155
161
        offset = 0
156
162
    tt = time.gmtime(t + offset)
157
163
 
262
268
        _serializers[version] = klass
263
269
        return
264
270
 
265
 
    if not _serializers.has_key(version):
 
271
    if version not in _serializers:
266
272
        _serializers[version] = klass
267
273
 
268
274