~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Robert Collins
  • Date: 2006-03-06 07:14:27 UTC
  • mto: (1594.2.4 integration)
  • mto: This revision was merged to the branch mainline in revision 1596.
  • Revision ID: robertc@robertcollins.net-20060306071427-359ef15c1d891e84
Add total_size to the revision_store api.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
                            sha_strings,
37
37
                            sha_string,
38
38
                            )
 
39
from bzrlib.store.revision.text import TextRevisionStore
39
40
from bzrlib.store.text import TextStore
40
41
from bzrlib.store.versioned import WeaveStore
41
42
from bzrlib.symbol_versioning import *
1338
1339
        self.bzrdir.transport.mkdir('revision-store')
1339
1340
        revision_transport = self.bzrdir.transport.clone('revision-store')
1340
1341
        # TODO permissions
1341
 
        revision_store = TextStore(revision_transport,
1342
 
                                   prefixed=False,
1343
 
                                   compressed=True)
 
1342
        _revision_store = TextRevisionStore(TextStore(revision_transport,
 
1343
                                                      prefixed=False,
 
1344
                                                      compressed=True))
1344
1345
        try:
 
1346
            transaction = bzrlib.transactions.PassThroughTransaction()
1345
1347
            for i, rev_id in enumerate(self.converted_revs):
1346
1348
                self.pb.update('write revision', i, len(self.converted_revs))
1347
 
                rev_tmp = StringIO()
1348
 
                serializer_v5.write_revision(self.revisions[rev_id], rev_tmp)
1349
 
                rev_tmp.seek(0)
1350
 
                revision_store.add(rev_tmp, rev_id)
 
1349
                _revision_store.add_revision(self.revisions[rev_id], transaction)
1351
1350
        finally:
1352
1351
            self.pb.clear()
1353
1352
            
1366
1365
                         rev_id)
1367
1366
            self.absent_revisions.add(rev_id)
1368
1367
        else:
1369
 
            rev_xml = self.branch.repository.revision_store.get(rev_id).read()
1370
 
            rev = serializer_v4.read_revision_from_string(rev_xml)
 
1368
            rev = self.branch.repository._revision_store.get_revision(rev_id,
 
1369
                self.branch.repository.get_transaction())
1371
1370
            for parent_id in rev.parent_ids:
1372
1371
                self.known_revisions.add(parent_id)
1373
1372
                self.to_read.append(parent_id)
1411
1410
                    (file_id, rev.revision_id)
1412
1411
        new_inv_xml = serializer_v5.write_inventory_to_string(inv)
1413
1412
        new_inv_sha1 = sha_string(new_inv_xml)
1414
 
        self.inv_weave.add(rev.revision_id, 
1415
 
                           present_parents,
1416
 
                           new_inv_xml.splitlines(True),
1417
 
                           new_inv_sha1)
 
1413
        self.inv_weave.add_lines(rev.revision_id, 
 
1414
                                 present_parents,
 
1415
                                 new_inv_xml.splitlines(True))
1418
1416
        rev.inventory_sha1 = new_inv_sha1
1419
1417
 
1420
1418
    def _convert_revision_contents(self, rev, inv, present_parents):