~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Martin Pool
  • Date: 2005-09-22 05:18:24 UTC
  • Revision ID: mbp@sourcefrog.net-20050922051824-263a54b20d3c54a4
- store control weaves in .bzr/, not mixed in with file weaves

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
import bzrlib.ui
40
40
 
41
41
 
42
 
INVENTORY_FILEID = '__inventory'
43
 
ANCESTRY_FILEID = '__ancestry'
44
 
 
45
 
 
46
42
BZR_BRANCH_FORMAT_4 = "Bazaar-NG branch, format 0.0.4\n"
47
43
BZR_BRANCH_FORMAT_5 = "Bazaar-NG branch, format 5\n"
48
44
## TODO: Maybe include checks for common corruption of newlines, etc?
212
208
                raise NotBranchError('not a bzr branch: %s' % quotefn(base),
213
209
                                     ['use "bzr init" to initialize a '
214
210
                                      'new working tree'])
215
 
        
216
211
        self._check_format(relax_version_check)
 
212
        cfn = self.controlfilename
217
213
        if self._branch_format == 4:
218
 
            self.inventory_store = \
219
 
                ImmutableStore(self.controlfilename('inventory-store'))
220
 
            self.text_store = \
221
 
                ImmutableStore(self.controlfilename('text-store'))
222
 
        self.weave_store = WeaveStore(self.controlfilename('weaves'))
223
 
        self.revision_store = \
224
 
            ImmutableStore(self.controlfilename('revision-store'))
 
214
            self.inventory_store = ImmutableStore(cfn('inventory-store'))
 
215
            self.text_store = ImmutableStore(cfn('text-store'))
 
216
        elif self._branch_format == 5:
 
217
            self.control_weaves = WeaveStore(cfn([]))
 
218
            self.weave_store = WeaveStore(cfn('weaves'))
 
219
        self.revision_store = ImmutableStore(cfn('revision-store'))
225
220
 
226
221
 
227
222
    def __str__(self):
666
661
        return bzrlib.osutils.sha_file(self.get_revision_xml_file(revision_id))
667
662
 
668
663
 
 
664
    def _get_ancestry_weave(self):
 
665
        return self.control_weaves.get_weave('ancestry')
 
666
        
 
667
 
669
668
    def get_ancestry(self, revision_id):
670
669
        """Return a list of revision-ids integrated by a revision.
671
670
        """
672
 
        w = self.weave_store.get_weave(ANCESTRY_FILEID)
673
671
        # strip newlines
 
672
        w = self._get_ancestry_weave()
674
673
        return [l[:-1] for l in w.get_iter(w.lookup(revision_id))]
675
674
 
676
675
 
677
676
    def get_inventory_weave(self):
678
 
        return self.weave_store.get_weave(INVENTORY_FILEID)
 
677
        return self.control_weaves.get_weave('inventory')
679
678
 
680
679
 
681
680
    def get_inventory(self, revision_id):