~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-07-25 14:45:20 UTC
  • mfrom: (3363.9.8 plan_merge)
  • Revision ID: pqm@pqm.ubuntu.com-20080725144520-ir7276gij462t1te
Implement plan_merge and set_parent_ids on PreviewTree

Show diffs side-by-side

added added

removed removed

Lines of Context:
1410
1410
        self._transform = transform
1411
1411
        self._final_paths = FinalPaths(transform)
1412
1412
        self.__by_parent = None
 
1413
        self._parent_ids = []
1413
1414
 
1414
1415
    def _changes(self, file_id):
1415
1416
        for changes in self._transform.iter_changes():
1423
1424
        # InterTree.iter_changes.
1424
1425
        return (changes is not None and changes[2])
1425
1426
 
 
1427
    def _get_repository(self):
 
1428
        repo = getattr(self._transform._tree, '_repository', None)
 
1429
        if repo is None:
 
1430
            repo = self._transform._tree.branch.repository
 
1431
        return repo
 
1432
 
 
1433
    def _iter_parent_trees(self):
 
1434
        for revision_id in self.get_parent_ids():
 
1435
            try:
 
1436
                yield self.revision_tree(revision_id)
 
1437
            except errors.NoSuchRevisionInTree:
 
1438
                yield self._get_repository().revision_tree(revision_id)
 
1439
 
1426
1440
    def _get_file_revision(self, file_id, vf, tree_revision):
1427
 
        return self._transform._tree._get_file_revision(file_id, vf,
1428
 
                                                        tree_revision)
 
1441
        parent_keys = [(file_id, self._file_revision(t, file_id)) for t in
 
1442
                       self._iter_parent_trees()]
 
1443
        vf.add_lines((file_id, tree_revision), parent_keys,
 
1444
                     self.get_file(file_id).readlines())
 
1445
        repo = self._get_repository()
 
1446
        base_vf = repo.texts
 
1447
        if base_vf not in vf.fallback_versionedfiles:
 
1448
            vf.fallback_versionedfiles.append(base_vf)
 
1449
        return tree_revision
1429
1450
 
1430
1451
    def _stat_limbo_file(self, file_id):
1431
1452
        trans_id = self._transform.trans_id_file_id(file_id)
1682
1703
        return self._transform._tree.walkdirs(prefix)
1683
1704
 
1684
1705
    def get_parent_ids(self):
1685
 
        return self._transform._tree.get_parent_ids()
 
1706
        return self._parent_ids
 
1707
 
 
1708
    def set_parent_ids(self, parent_ids):
 
1709
        self._parent_ids = parent_ids
1686
1710
 
1687
1711
    def get_revision_tree(self, revision_id):
1688
1712
        return self._transform._tree.get_revision_tree(revision_id)