~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store/revision/knit.py

  • Committer: Martin Pool
  • Date: 2006-06-20 07:55:43 UTC
  • mfrom: (1798 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1799.
  • Revision ID: mbp@sourcefrog.net-20060620075543-b10f6575d4a4fa32
[merge] bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
        rev_file = self.get_revision_file(transaction)
78
78
        return rev_file.get_ancestry(rev_file.versions())
79
79
 
80
 
    def get_revision(self, revision_id, transaction):
81
 
        """See RevisionStore.get_revision()."""
82
 
        xml = self._get_revision_xml(revision_id, transaction)
 
80
    def get_revisions(self, revision_ids, transaction):
 
81
        """See RevisionStore.get_revisions()."""
 
82
        texts = self._get_serialized_revisions(revision_ids, transaction)
 
83
        revisions = []
83
84
        try:
84
 
            r = self._serializer.read_revision_from_string(xml)
 
85
            for text, revision_id in zip(texts, revision_ids):
 
86
                r = self._serializer.read_revision_from_string(text)
 
87
                assert r.revision_id == revision_id
 
88
                revisions.append(r)
85
89
        except SyntaxError, e:
86
90
            raise errors.BzrError('failed to unpack revision_xml',
87
91
                                   [revision_id,
88
92
                                   str(e)])
89
 
        assert r.revision_id == revision_id
90
 
        return r
 
93
        return revisions 
 
94
 
 
95
    def _get_serialized_revisions(self, revision_ids, transaction):
 
96
        texts = []
 
97
        vf = self.get_revision_file(transaction)
 
98
        try:
 
99
            return vf.get_texts(revision_ids)
 
100
        except (errors.RevisionNotPresent), e:
 
101
            raise errors.NoSuchRevision(self, e.revision_id)
91
102
 
92
103
    def _get_revision_xml(self, revision_id, transaction):
93
104
        try:
121
132
 
122
133
    def total_size(self, transaction):
123
134
        """ See RevisionStore.total_size()."""
124
 
        return (len(self.all_revision_ids(transaction)), 
 
135
        return (len(self.all_revision_ids(transaction)),
125
136
            self.versioned_file_store.total_size()[1])