~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Martin Pool
  • Date: 2005-09-07 04:00:21 UTC
  • Revision ID: mbp@sourcefrog.net-20050907040020-2c7a5e0176888d95
- BROKEN: partial support for commit into weave

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
from bzrlib.revision import Revision
31
31
from bzrlib.delta import compare_trees
32
32
from bzrlib.tree import EmptyTree, RevisionTree
33
 
import bzrlib.xml
 
33
import bzrlib.xml5
34
34
import bzrlib.ui
35
35
 
36
36
 
309
309
            "This is a Bazaar-NG control directory.\n"
310
310
            "Do not change any files in this directory.\n")
311
311
        self.controlfile('branch-format', 'w').write(BZR_BRANCH_FORMAT_5)
312
 
        for d in ('text-store', 'inventory-store', 'revision-store'):
 
312
        for d in ('text-store', 'inventory-store', 'revision-store',
 
313
                  'weaves'):
313
314
            os.mkdir(self.controlfilename(d))
314
315
        for f in ('revision-history', 'merged-patches',
315
316
                  'pending-merged-patches', 'branch-name',
322
323
        # them; they're not needed for now and so ommitted for
323
324
        # simplicity.
324
325
        f = self.controlfile('inventory','w')
325
 
        bzrlib.xml.serializer_v4.write_inventory(Inventory(), f)
 
326
        bzrlib.xml5.serializer_v5.write_inventory(Inventory(), f)
326
327
 
327
328
 
328
329
    def _check_format(self):
369
370
            # ElementTree does its own conversion from UTF-8, so open in
370
371
            # binary.
371
372
            f = self.controlfile('inventory', 'rb')
372
 
            return bzrlib.xml.serializer_v4.read_inventory(f)
 
373
            return bzrlib.xml5.serializer_v5.read_inventory(f)
373
374
        finally:
374
375
            self.unlock()
375
376
            
386
387
        try:
387
388
            f = AtomicFile(self.controlfilename('inventory'), 'wb')
388
389
            try:
389
 
                bzrlib.xml.serializer_v4.write_inventory(inv, f)
 
390
                bzrlib.xml5.serializer_v5.write_inventory(inv, f)
390
391
                f.commit()
391
392
            finally:
392
393
                f.close()
601
602
        xml_file = self.get_revision_xml_file(revision_id)
602
603
 
603
604
        try:
604
 
            r = bzrlib.xml.serializer_v4.read_revision(xml_file)
 
605
            r = bzrlib.xml5.serializer_v5.read_revision(xml_file)
605
606
        except SyntaxError, e:
606
607
            raise bzrlib.errors.BzrError('failed to unpack revision_xml',
607
608
                                         [revision_id,
654
655
        from bzrlib.inventory import Inventory
655
656
 
656
657
        f = self.get_inventory_xml_file(inventory_id)
657
 
        return bzrlib.xml.serializer_v4.read_inventory(f)
 
658
        return bzrlib.xml5.serializer_v5.read_inventory(f)
658
659
 
659
660
 
660
661
    def get_inventory_xml(self, inventory_id):
872
873
       
873
874
 
874
875
    def commit(self, *args, **kw):
875
 
        from bzrlib.commit import commit
876
 
        commit(self, *args, **kw)
 
876
        from bzrlib.commit import Commit
 
877
        Commit().commit(self, *args, **kw)
877
878
        
878
879
 
879
880
    def lookup_revision(self, revision):