~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

Correctly decode utf8 revision ids from knits when parsing, fixes a regression where a unicode revision id is stored correctly, but then indexed by the utf8 value on the next invocation of bzr, rather than the unicode value.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1063
1063
            self._history.append(version_id)
1064
1064
        else:
1065
1065
            index = self._cache[version_id][5]
1066
 
        self._cache[version_id] = (version_id, 
 
1066
        self._cache[version_id] = (version_id,
1067
1067
                                   options,
1068
1068
                                   pos,
1069
1069
                                   size,
1082
1082
        # so - wc -l of a knit index is != the number of unique names
1083
1083
        # in the knit.
1084
1084
        self._history = []
 
1085
        decode_utf8 = cache_utf8.decode
1085
1086
        pb = bzrlib.ui.ui_factory.nested_progress_bar()
1086
1087
        try:
1087
1088
            count = 0
1115
1116
                        for value in rec[4:-1]:
1116
1117
                            if '.' == value[0]:
1117
1118
                                # uncompressed reference
1118
 
                                parents.append(value[1:])
 
1119
                                parents.append(decode_utf8(value[1:]))
1119
1120
                            else:
1120
1121
                                # this is 15/4000ms faster than isinstance,
1121
1122
                                # (in lsprof)
1124
1125
                                assert value.__class__ is str
1125
1126
                                parents.append(self._history[int(value)])
1126
1127
                        # end self._parse_parents
1127
 
                        # self._cache_version(rec[0], 
 
1128
                        # self._cache_version(decode_utf8(rec[0]),
1128
1129
                        #                     rec[1].split(','),
1129
1130
                        #                     int(rec[2]),
1130
1131
                        #                     int(rec[3]),
1132
1133
                        # --- self._cache_version
1133
1134
                        # only want the _history index to reference the 1st 
1134
1135
                        # index entry for version_id
1135
 
                        version_id = rec[0]
 
1136
                        version_id = decode_utf8(rec[0])
1136
1137
                        if version_id not in self._cache:
1137
1138
                            index = len(self._history)
1138
1139
                            self._history.append(version_id)
1174
1175
        for value in compressed_parents:
1175
1176
            if value[-1] == '.':
1176
1177
                # uncompressed reference
1177
 
                result.append(value[1:])
 
1178
                result.append(cache_utf8.decode_utf8(value[1:]))
1178
1179
            else:
1179
1180
                # this is 15/4000ms faster than isinstance,
1180
1181
                # this function is called thousands of times a