~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Aaron Bentley
  • Date: 2006-09-21 18:14:14 UTC
  • mto: This revision was merged to the branch mainline in revision 2048.
  • Revision ID: abentley@panoramicfeedback.com-20060921181414-f913391df42bffaf
Bundle 0.9 uses Testament 3 strict

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
from bzrlib.bundle.serializer import BUNDLE_HEADER
2
 
from bzrlib.bundle.serializer.v08 import BundleSerializerV08
 
2
from bzrlib.bundle.serializer.v08 import BundleSerializerV08, BundleReader
 
3
from bzrlib.testament import StrictTestament2
 
4
from bzrlib.bundle.bundle_data import BundleInfo
3
5
 
4
6
class BundleSerializerV09(BundleSerializerV08):
5
7
 
13
15
        f.write('0.9\n')
14
16
        f.write('#\n')
15
17
 
 
18
    def _testament_sha1(self, revision_id):
 
19
        return StrictTestament2.from_revision(self.source, 
 
20
                                              revision_id).as_sha1()
 
21
 
 
22
    def read(self, f):
 
23
        """Read the rest of the bundles from the supplied file.
 
24
 
 
25
        :param f: The file to read from
 
26
        :return: A list of bundles
 
27
        """
 
28
        return BundleReaderV09(f).info
 
29
 
 
30
 
 
31
class BundleInfo09(BundleInfo):
 
32
 
 
33
    def _testament_sha1_from_revision(self, repository, revision_id):
 
34
        testament = StrictTestament2.from_revision(repository, revision_id)
 
35
        return testament.as_sha1()
 
36
 
 
37
    def _testament_sha1(self, revision, inventory):
 
38
        return StrictTestament2(revision, inventory).as_sha1()
 
39
 
 
40
class BundleReaderV09(BundleReader):
 
41
    
 
42
    def _get_info(self):
 
43
        return BundleInfo09()