~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Vincent Ladeuil
  • Date: 2008-09-11 19:36:38 UTC
  • mfrom: (3703 +trunk)
  • mto: (3705.1.1 trunk2)
  • mto: This revision was merged to the branch mainline in revision 3708.
  • Revision ID: v.ladeuil+lp@free.fr-20080911193638-wtjyc1kcmacc6t1f
merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1166
1166
                     t in self.revision_trees(required_trees))
1167
1167
        for revision in revisions:
1168
1168
            if not revision.parent_ids:
1169
 
                old_tree = self.revision_tree(None)
 
1169
                old_tree = self.revision_tree(_mod_revision.NULL_REVISION)
1170
1170
            else:
1171
1171
                old_tree = trees[revision.parent_ids[0]]
1172
1172
            yield trees[revision.revision_id].changes_from(old_tree)
1658
1658
    def revision_tree(self, revision_id):
1659
1659
        """Return Tree for a revision on this branch.
1660
1660
 
1661
 
        `revision_id` may be None for the empty tree revision.
 
1661
        `revision_id` may be NULL_REVISION for the empty tree revision.
1662
1662
        """
 
1663
        revision_id = _mod_revision.ensure_null(revision_id)
1663
1664
        # TODO: refactor this to use an existing revision object
1664
1665
        # so we don't need to read it in twice.
1665
 
        if revision_id is None or revision_id == _mod_revision.NULL_REVISION:
 
1666
        if revision_id == _mod_revision.NULL_REVISION:
1666
1667
            return RevisionTree(self, Inventory(root_id=None), 
1667
1668
                                _mod_revision.NULL_REVISION)
1668
1669
        else:
1959
1960
            present_parents.append(p_id)
1960
1961
            parent_trees[p_id] = repository.revision_tree(p_id)
1961
1962
        else:
1962
 
            parent_trees[p_id] = repository.revision_tree(None)
 
1963
            parent_trees[p_id] = repository.revision_tree(
 
1964
                                     _mod_revision.NULL_REVISION)
1963
1965
 
1964
1966
    inv = revision_tree.inventory
1965
1967
    entries = inv.iter_entries()
2916
2918
                RepositoryFormatPackDevelopment1,
2917
2919
                RepositoryFormatPackDevelopment1Subtree,
2918
2920
                )
2919
 
            nosubtrees = (
2920
 
                RepositoryFormatKnit1,
2921
 
                RepositoryFormatKnitPack1,
2922
 
                RepositoryFormatPackDevelopment1,
2923
 
                RepositoryFormatKnitPack4,
2924
 
                RepositoryFormatKnitPack5,
2925
 
                RepositoryFormatKnitPack5RichRoot,
2926
 
                )
2927
 
            subtrees = (
2928
 
                RepositoryFormatKnit3,
2929
 
                RepositoryFormatKnitPack3,
2930
 
                RepositoryFormatPackDevelopment1Subtree,
2931
 
                )
2932
 
            return (isinstance(source._format, nosubtrees) and
2933
 
                isinstance(target._format, subtrees))
 
2921
            norichroot = (
 
2922
                RepositoryFormatKnit1,            # no rr, no subtree
 
2923
                RepositoryFormatKnitPack1,        # no rr, no subtree
 
2924
                RepositoryFormatPackDevelopment1, # no rr, no subtree
 
2925
                RepositoryFormatKnitPack5,        # no rr, no subtree
 
2926
                )
 
2927
            richroot = (
 
2928
                RepositoryFormatKnit3,            # rr, subtree
 
2929
                RepositoryFormatKnitPack3,        # rr, subtree
 
2930
                RepositoryFormatKnitPack4,        # rr, no subtree
 
2931
                RepositoryFormatKnitPack5RichRoot,# rr, no subtree
 
2932
                RepositoryFormatPackDevelopment1Subtree, # rr, subtree
 
2933
                )
 
2934
            for format in norichroot:
 
2935
                if format.rich_root_data:
 
2936
                    raise AssertionError('Format %s is a rich-root format'
 
2937
                        ' but is included in the non-rich-root list'
 
2938
                        % (format,))
 
2939
            for format in richroot:
 
2940
                if not format.rich_root_data:
 
2941
                    raise AssertionError('Format %s is not a rich-root format'
 
2942
                        ' but is included in the rich-root list'
 
2943
                        % (format,))
 
2944
            # TODO: One alternative is to just check format.rich_root_data,
 
2945
            #       instead of keeping membership lists. However, the formats
 
2946
            #       *also* have to use the same 'Knit' style of storage
 
2947
            #       (line-deltas, fulltexts, etc.)
 
2948
            return (isinstance(source._format, norichroot) and
 
2949
                    isinstance(target._format, richroot))
2934
2950
        except AttributeError:
2935
2951
            return False
2936
2952