~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Aaron Bentley
  • Date: 2008-06-06 16:40:46 UTC
  • mfrom: (3482 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3483.
  • Revision ID: aaron@aaronbentley.com-20080606164046-ghbxplxuhtpcb9iz
Merge with bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
724
724
        self._transport.put_bytes('pending-merges', '\n'.join(merges),
725
725
            mode=self._control_files._file_mode)
726
726
 
 
727
    def _filter_parent_ids_by_ancestry(self, revision_ids):
 
728
        """Check that all merged revisions are proper 'heads'.
 
729
 
 
730
        This will always return the first revision_id, and any merged revisions
 
731
        which are 
 
732
        """
 
733
        if len(revision_ids) == 0:
 
734
            return revision_ids
 
735
        graph = self.branch.repository.get_graph()
 
736
        heads = graph.heads(revision_ids)
 
737
        new_revision_ids = revision_ids[:1]
 
738
        for revision_id in revision_ids[1:]:
 
739
            if revision_id in heads and revision_id not in new_revision_ids:
 
740
                new_revision_ids.append(revision_id)
 
741
        if new_revision_ids != revision_ids:
 
742
            trace.mutter('requested to set revision_ids = %s,'
 
743
                         ' but filtered to %s', revision_ids, new_revision_ids)
 
744
        return new_revision_ids
 
745
 
727
746
    @needs_tree_write_lock
728
747
    def set_parent_ids(self, revision_ids, allow_leftmost_as_ghost=False):
729
748
        """Set the parent ids to revision_ids.
742
761
        for revision_id in revision_ids:
743
762
            _mod_revision.check_not_reserved_id(revision_id)
744
763
 
 
764
        revision_ids = self._filter_parent_ids_by_ancestry(revision_ids)
 
765
 
745
766
        if len(revision_ids) > 0:
746
767
            self.set_last_revision(revision_ids[0])
747
768
        else:
759
780
        self._check_parents_for_ghosts(parent_ids,
760
781
            allow_leftmost_as_ghost=allow_leftmost_as_ghost)
761
782
 
 
783
        parent_ids = self._filter_parent_ids_by_ancestry(parent_ids)
 
784
 
762
785
        if len(parent_ids) == 0:
763
786
            leftmost_parent_id = _mod_revision.NULL_REVISION
764
787
            leftmost_parent_tree = None