equal
deleted
inserted
replaced
3155 msg = "cannot rewrite_sidedata of a delayed revlog" |
3155 msg = "cannot rewrite_sidedata of a delayed revlog" |
3156 raise error.ProgrammingError(msg) |
3156 raise error.ProgrammingError(msg) |
3157 |
3157 |
3158 new_entries = [] |
3158 new_entries = [] |
3159 # append the new sidedata |
3159 # append the new sidedata |
3160 with self._datafp(b'a+') as dfh: |
3160 with self._writing(transaction): |
3161 # Maybe this bug still exists, see revlog._writeentry |
3161 ifh, dfh = self._writinghandles |
3162 dfh.seek(0, os.SEEK_END) |
3162 dfh.seek(0, os.SEEK_END) |
3163 current_offset = dfh.tell() |
3163 current_offset = dfh.tell() |
3164 for rev in range(startrev, endrev + 1): |
3164 for rev in range(startrev, endrev + 1): |
3165 entry = self.index[rev] |
3165 entry = self.index[rev] |
3166 new_sidedata, flags = sidedatautil.run_sidedata_helpers( |
3166 new_sidedata, flags = sidedatautil.run_sidedata_helpers( |
3190 dfh.seek(current_offset, os.SEEK_SET) |
3190 dfh.seek(current_offset, os.SEEK_SET) |
3191 dfh.write(serialized_sidedata) |
3191 dfh.write(serialized_sidedata) |
3192 new_entries.append(entry) |
3192 new_entries.append(entry) |
3193 current_offset += len(serialized_sidedata) |
3193 current_offset += len(serialized_sidedata) |
3194 |
3194 |
3195 # rewrite the new index entries |
3195 # rewrite the new index entries |
3196 with self._indexfp(b'r+') as ifh: |
3196 ifh.seek(startrev * self.index.entry_size) |
3197 fp.seek(startrev * self.index.entry_size) |
|
3198 for i, e in enumerate(new_entries): |
3197 for i, e in enumerate(new_entries): |
3199 rev = startrev + i |
3198 rev = startrev + i |
3200 self.index.replace_sidedata_info(rev, e[8], e[9], e[0]) |
3199 self.index.replace_sidedata_info(rev, e[8], e[9], e[0]) |
3201 packed = self.index.entry_binary(rev) |
3200 packed = self.index.entry_binary(rev) |
3202 if rev == 0: |
3201 if rev == 0: |