~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Martin Pool
  • Date: 2005-09-13 05:11:27 UTC
  • Revision ID: mbp@sourcefrog.net-20050913051127-47c500210200a219
- branch now tracks ancestry - all merged revisions

 - new Branch.get_ancestry() returns them as a list

 - basic test for this

 - commit appends to ancestry (only for non-merge commits)
 
 - clean up imports

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
from bzrlib.tree import EmptyTree, RevisionTree
34
34
from bzrlib.inventory import Inventory
35
35
from bzrlib.weavestore import WeaveStore
 
36
from bzrlib.store import ImmutableStore
36
37
import bzrlib.xml5
37
38
import bzrlib.ui
38
39
 
194
195
        In the test suite, creation of new trees is tested using the
195
196
        `ScratchBranch` class.
196
197
        """
197
 
        from bzrlib.store import ImmutableStore
198
198
        if init:
199
199
            self.base = os.path.realpath(base)
200
200
            self._make_control()
329
329
        # simplicity.
330
330
        f = self.controlfile('inventory','w')
331
331
        bzrlib.xml5.serializer_v5.write_inventory(Inventory(), f)
 
332
        
332
333
 
333
334
 
334
335
    def _check_format(self):
650
651
        return bzrlib.osutils.sha_file(self.get_revision_xml(revision_id))
651
652
 
652
653
 
 
654
    def get_ancestry(self, revision_id):
 
655
        """Return a list of revision-ids integrated by a revision.
 
656
        """
 
657
        w = self.weave_store.get_weave(ANCESTRY_FILEID)
 
658
        # strip newlines
 
659
        return [l[:-1] for l in w.get_iter(w.lookup(revision_id))]
 
660
 
 
661
 
653
662
    def get_inventory_weave(self):
654
663
        return self.weave_store.get_weave(INVENTORY_FILEID)
655
664