~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

  • Committer: John Arbash Meinel
  • Date: 2008-03-05 17:48:46 UTC
  • mto: This revision was merged to the branch mainline in revision 3280.
  • Revision ID: john@arbash-meinel.com-20080305174846-mlcmszy3gbntuowj
Clean up some variable ordering to make more sense.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1109
1109
    def _get_record_map(self, version_ids):
1110
1110
        """Produce a dictionary of knit records.
1111
1111
        
1112
 
        The keys are version_ids, the values are tuples of (record_details,
1113
 
        content, digest, next).
1114
 
        method is the way the content should be applied.  
1115
 
        content is a KnitContent object.
1116
 
        digest is the SHA1 digest of this version id after all steps are done
1117
 
        next is the build-parent of the version, i.e. the leftmost ancestor.
1118
 
        If the method is fulltext, next will be None.
 
1112
        :return: {version_id:(record, record_details, digest, next)}
 
1113
            record
 
1114
                data returned from read_records
 
1115
            record_details
 
1116
                opaque information to pass to parse_record
 
1117
            digest
 
1118
                SHA1 digest of the full text after all steps are done
 
1119
            next
 
1120
                build-parent of the version, i.e. the leftmost ancestor.
 
1121
                Will be None if the record is not a delta.
1119
1122
        """
1120
1123
        position_map = self._get_components_positions(version_ids)
1121
1124
        # c = component_id, r = record_details, i_m = index_memo, n = next
1122
1125
        records = [(c, i_m) for c, (r, i_m, n)
1123
1126
                             in position_map.iteritems()]
1124
1127
        record_map = {}
1125
 
        for component_id, content, digest in \
 
1128
        for component_id, record, digest in \
1126
1129
                self._data.read_records_iter(records):
1127
1130
            (record_details, index_memo, next) = position_map[component_id]
1128
 
            record_map[component_id] = record_details, content, digest, next
 
1131
            record_map[component_id] = record, record_details, digest, next
1129
1132
 
1130
1133
        return record_map
1131
1134
 
1167
1170
            components = []
1168
1171
            cursor = version_id
1169
1172
            while cursor is not None:
1170
 
                record_details, data, digest, next = record_map[cursor]
1171
 
                components.append((cursor, record_details, data, digest))
 
1173
                record, record_details, digest, next = record_map[cursor]
 
1174
                components.append((cursor, record, record_details, digest))
1172
1175
                if cursor in content_map:
1173
1176
                    break
1174
1177
                cursor = next
1175
1178
 
1176
1179
            content = None
1177
 
            for (component_id, record_details, data,
 
1180
            for (component_id, record, record_details,
1178
1181
                 digest) in reversed(components):
1179
1182
                if component_id in content_map:
1180
1183
                    content = content_map[component_id]
1181
1184
                else:
1182
1185
                    content, delta = self.factory.parse_record(version_id,
1183
 
                        data, record_details, content,
 
1186
                        record, record_details, content,
1184
1187
                        copy_base_content=multiple_versions)
1185
1188
                    if multiple_versions:
1186
1189
                        content_map[component_id] = content