/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: Carl Friedrich Bolz
  • Date: 2006-09-06 21:17:22 UTC
  • mfrom: (1977 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2026.
  • Revision ID: cfbolz@gmx.de-20060906211722-b04f9c3ad1f53ef1
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
        raise errors.NotABundle('Did not find an opening header')
70
70
 
71
71
    # Now we have a version, to figure out how to read the bundle 
72
 
    if not _serializers.has_key(version):
 
72
    if version not in _serializers:
73
73
        raise errors.BundleNotSupported(version, 
74
74
            'version not listed in known versions')
75
75
 
87
87
    :param version: [optional] target serialization version
88
88
    """
89
89
 
90
 
    if not _serializers.has_key(version):
 
90
    if version not in _serializers:
91
91
        raise errors.BundleNotSupported(version, 'unknown bundle format')
92
92
 
93
93
    serializer = _serializers[version](version)
94
 
    return serializer.write(source, revision_ids, forced_bases, f) 
 
94
    source.lock_read()
 
95
    try:
 
96
        return serializer.write(source, revision_ids, forced_bases, f)
 
97
    finally:
 
98
        source.unlock()
95
99
 
96
100
 
97
101
def write_bundle(repository, revision_id, base_revision_id, out):
98
102
    """"""
 
103
    repository.lock_read()
 
104
    try:
 
105
        return _write_bundle(repository, revision_id, base_revision_id, out)
 
106
    finally:
 
107
        repository.unlock()
 
108
 
 
109
 
 
110
def _write_bundle(repository, revision_id, base_revision_id, out):
99
111
    if base_revision_id is NULL_REVISION:
100
112
        base_revision_id = None
101
113
    base_ancestry = set(repository.get_ancestry(base_revision_id))
250
262
        _serializers[version] = klass
251
263
        return
252
264
 
253
 
    if not _serializers.has_key(version):
 
265
    if version not in _serializers:
254
266
        _serializers[version] = klass
255
267
 
256
268