equal
deleted
inserted
replaced
236 'than 0') % self._chunkcachesize) |
236 'than 0') % self._chunkcachesize) |
237 elif self._chunkcachesize & (self._chunkcachesize - 1): |
237 elif self._chunkcachesize & (self._chunkcachesize - 1): |
238 raise RevlogError(_('revlog chunk cache size %r is not a power ' |
238 raise RevlogError(_('revlog chunk cache size %r is not a power ' |
239 'of 2') % self._chunkcachesize) |
239 'of 2') % self._chunkcachesize) |
240 |
240 |
241 i = '' |
241 indexdata = '' |
242 self._initempty = True |
242 self._initempty = True |
243 try: |
243 try: |
244 f = self.opener(self.indexfile) |
244 f = self.opener(self.indexfile) |
245 i = f.read() |
245 indexdata = f.read() |
246 f.close() |
246 f.close() |
247 if len(i) > 0: |
247 if len(indexdata) > 0: |
248 v = struct.unpack(versionformat, i[:4])[0] |
248 v = struct.unpack(versionformat, indexdata[:4])[0] |
249 self._initempty = False |
249 self._initempty = False |
250 except IOError as inst: |
250 except IOError as inst: |
251 if inst.errno != errno.ENOENT: |
251 if inst.errno != errno.ENOENT: |
252 raise |
252 raise |
253 |
253 |
268 |
268 |
269 self._io = revlogio() |
269 self._io = revlogio() |
270 if self.version == REVLOGV0: |
270 if self.version == REVLOGV0: |
271 self._io = revlogoldio() |
271 self._io = revlogoldio() |
272 try: |
272 try: |
273 d = self._io.parseindex(i, self._inline) |
273 d = self._io.parseindex(indexdata, self._inline) |
274 except (ValueError, IndexError): |
274 except (ValueError, IndexError): |
275 raise RevlogError(_("index %s is corrupted") % (self.indexfile)) |
275 raise RevlogError(_("index %s is corrupted") % (self.indexfile)) |
276 self.index, nodemap, self._chunkcache = d |
276 self.index, nodemap, self._chunkcache = d |
277 if nodemap is not None: |
277 if nodemap is not None: |
278 self.nodemap = self._nodecache = nodemap |
278 self.nodemap = self._nodecache = nodemap |