~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Robert Collins
  • Date: 2005-10-06 22:15:52 UTC
  • mfrom: (1185.13.2)
  • mto: This revision was merged to the branch mainline in revision 1420.
  • Revision ID: robertc@robertcollins.net-20051006221552-9b15c96fa504e0ad
mergeĀ fromĀ upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
                           DivergedBranches, LockError, UnlistableStore,
35
35
                           UnlistableBranch, NoSuchFile)
36
36
from bzrlib.textui import show_status
37
 
from bzrlib.revision import Revision, validate_revision_id, is_ancestor
 
37
from bzrlib.revision import Revision
38
38
from bzrlib.delta import compare_trees
39
39
from bzrlib.tree import EmptyTree, RevisionTree
40
40
from bzrlib.inventory import Inventory
134
134
    def open(base):
135
135
        """Open an existing branch, rooted at 'base' (url)"""
136
136
        t = get_transport(base)
 
137
        mutter("trying to open %r with transport %r", base, t)
137
138
        return _Branch(t)
138
139
 
139
140
    @staticmethod
465
466
            fmt = self.controlfile('branch-format', 'r').read()
466
467
        except NoSuchFile:
467
468
            raise NotBranchError(self.base)
468
 
 
 
469
        mutter("got branch format %r", fmt)
469
470
        if fmt == BZR_BRANCH_FORMAT_5:
470
471
            self._branch_format = 5
471
472
        elif fmt == BZR_BRANCH_FORMAT_4:
780
781
        # But for now, just hash the contents.
781
782
        return bzrlib.osutils.sha_file(self.get_revision_xml_file(revision_id))
782
783
 
783
 
    def _get_ancestry_weave(self):
784
 
        return self.control_weaves.get_weave('ancestry')
785
 
 
786
784
    def get_ancestry(self, revision_id):
787
785
        """Return a list of revision-ids integrated by a revision.
 
786
        
 
787
        This currently returns a list, but the ordering is not guaranteed:
 
788
        treat it as a set.
788
789
        """
789
 
        # strip newlines
790
790
        if revision_id is None:
791
791
            return [None]
792
 
        w = self._get_ancestry_weave()
793
 
        return [None] + [l[:-1] for l in w.get_iter(w.lookup(revision_id))]
 
792
        w = self.control_weaves.get_weave('inventory')
 
793
        return [None] + map(w.idx_to_name,
 
794
                            w.inclusions([w.lookup(revision_id)]))
794
795
 
795
796
    def get_inventory_weave(self):
796
797
        return self.control_weaves.get_weave('inventory')
1200
1201
    def add_pending_merge(self, *revision_ids):
1201
1202
        # TODO: Perhaps should check at this point that the
1202
1203
        # history of the revision is actually present?
1203
 
        for rev_id in revision_ids:
1204
 
            validate_revision_id(rev_id)
1205
 
 
1206
1204
        p = self.pending_merges()
1207
1205
        updated = False
1208
1206
        for rev_id in revision_ids: