~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

Merge serialize-transform into prepare-shelf

Show diffs side-by-side

added added

removed removed

Lines of Context:
1127
1127
        return _PreviewTree(self)
1128
1128
 
1129
1129
    def _get_parents_texts(self, trans_id):
 
1130
        """Get texts for compression parents of this file."""
1130
1131
        file_id = self.tree_file_id(trans_id)
1131
1132
        try:
1132
1133
            if file_id is None or self._tree.kind(file_id) != 'file':
1136
1137
        return (self._tree.get_file_text(file_id),)
1137
1138
 
1138
1139
    def _get_parents_lines(self, trans_id):
 
1140
        """Get lines for compression parents of this file."""
1139
1141
        return tuple(osutils.split_lines(p) for p
1140
1142
                     in self._get_parents_texts(trans_id))
1141
1143
 
1142
1144
    def serialize(self, serializer):
 
1145
        """Serialize this TreeTransform.
 
1146
 
 
1147
        :param serializer: A Serialiser like pack.ContainerSerializer.
 
1148
        """
1143
1149
        new_name = dict((k, v.encode('utf-8')) for k, v in
1144
1150
                        self._new_name.items())
1145
1151
        new_executability = dict((k, int(v)) for k, v in
1177
1183
 
1178
1184
 
1179
1185
    def deserialize(self, records):
 
1186
        """Deserialize a stored TreeTransform.
 
1187
 
 
1188
        :param records: An iterable of (names, content) tuples, as per
 
1189
            pack.ContainerPushParser.
 
1190
        """
1180
1191
        names, content = records.next()
1181
1192
        attribs = bencode.bdecode(content)
1182
1193
        self._id_number = attribs['_id_number']
1835
1846
                      require_versioned=True, want_unversioned=False):
1836
1847
        """See InterTree.iter_changes.
1837
1848
 
1838
 
        This implementation does not support include_unchanged, specific_files,
1839
 
        or want_unversioned.  extra_trees, require_versioned, and pb are
1840
 
        ignored.
 
1849
        This has a fast path that is only used when the from_tree matches
 
1850
        the transform tree, and no fancy options are supplied.
1841
1851
        """
1842
 
        if from_tree is not self._transform._tree:
 
1852
        if (from_tree is not self._transform._tree or include_unchanged or
 
1853
            specific_files or want_unversioned):
1843
1854
            return tree.InterTree(from_tree, self).iter_changes(
1844
1855
                include_unchanged=include_unchanged,
1845
1856
                specific_files=specific_files,
1847
1858
                extra_trees=extra_trees,
1848
1859
                require_versioned=require_versioned,
1849
1860
                want_unversioned=want_unversioned)
1850
 
        if include_unchanged:
1851
 
            raise ValueError('include_unchanged is not supported')
1852
 
        if specific_files is not None:
1853
 
            raise ValueError('specific_files is not supported')
1854
1861
        if want_unversioned:
1855
1862
            raise ValueError('want_unversioned is not supported')
1856
1863
        return self._transform.iter_changes()