~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-05-06 03:17:25 UTC
  • mfrom: (4324.3.4 bug-368921)
  • Revision ID: pqm@pqm.ubuntu.com-20090506031725-stmw1gm2fs6qpq0f
(robertc) Calculate new rich root parent data with logic consistent
        with reconcile. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3557
3557
        """Get the parent keys for a given root id."""
3558
3558
        root_id, rev_id = root_key
3559
3559
        # Include direct parents of the revision, but only if they used
3560
 
        # the same root_id.
 
3560
        # the same root_id and are heads.
3561
3561
        parent_keys = []
3562
3562
        for parent_id in parent_map[rev_id]:
3563
3563
            if parent_id == _mod_revision.NULL_REVISION:
3577
3577
                self._revision_id_to_root_id[parent_id] = None
3578
3578
            else:
3579
3579
                parent_root_id = self._revision_id_to_root_id[parent_id]
3580
 
            if root_id == parent_root_id or parent_root_id is None:
3581
 
                parent_keys.append((root_id, parent_id))
3582
 
        return tuple(parent_keys)
 
3580
            if root_id == parent_root_id:
 
3581
                # With stacking we _might_ want to refer to a non-local
 
3582
                # revision, but this code path only applies when we have the
 
3583
                # full content available, so ghosts really are ghosts, not just
 
3584
                # the edge of local data.
 
3585
                parent_keys.append((parent_id,))
 
3586
            else:
 
3587
                # root_id may be in the parent anyway.
 
3588
                try:
 
3589
                    tree = self.source.revision_tree(parent_id)
 
3590
                except errors.NoSuchRevision:
 
3591
                    # ghost, can't refer to it.
 
3592
                    pass
 
3593
                else:
 
3594
                    try:
 
3595
                        parent_keys.append((tree.inventory[root_id].revision,))
 
3596
                    except errors.NoSuchId:
 
3597
                        # not in the tree
 
3598
                        pass
 
3599
        g = graph.Graph(self.source.revisions)
 
3600
        heads = g.heads(parent_keys)
 
3601
        selected_keys = []
 
3602
        for key in parent_keys:
 
3603
            if key in heads and key not in selected_keys:
 
3604
                selected_keys.append(key)
 
3605
        return tuple([(root_id,)+ key for key in selected_keys])
3583
3606
 
3584
3607
    def _new_root_data_stream(self, root_keys_to_create, parent_map):
3585
3608
        for root_key in root_keys_to_create: