Show More
@@ -487,7 +487,7 b' class revlog(object):' | |||||
487 | raise |
|
487 | raise | |
488 | return b'' |
|
488 | return b'' | |
489 |
|
489 | |||
490 | def _loadindex(self): |
|
490 | def _loadindex(self, docket=None): | |
491 |
|
491 | |||
492 | new_header, mmapindexthreshold, force_nodemap = self._init_opts() |
|
492 | new_header, mmapindexthreshold, force_nodemap = self._init_opts() | |
493 |
|
493 | |||
@@ -498,45 +498,51 b' class revlog(object):' | |||||
498 | else: |
|
498 | else: | |
499 | entry_point = b'%s.i' % self.radix |
|
499 | entry_point = b'%s.i' % self.radix | |
500 |
|
500 | |||
501 | entry_data = b'' |
|
501 | if docket is not None: | |
502 |
self._ |
|
502 | self._docket = docket | |
503 | entry_data = self._get_data(entry_point, mmapindexthreshold) |
|
503 | self._docket_file = entry_point | |
504 | if len(entry_data) > 0: |
|
|||
505 | header = INDEX_HEADER.unpack(entry_data[:4])[0] |
|
|||
506 | self._initempty = False |
|
|||
507 | else: |
|
504 | else: | |
508 | header = new_header |
|
505 | entry_data = b'' | |
509 |
|
506 | self._initempty = True | ||
510 | self._format_flags = header & ~0xFFFF |
|
507 | entry_data = self._get_data(entry_point, mmapindexthreshold) | |
511 | self._format_version = header & 0xFFFF |
|
508 | if len(entry_data) > 0: | |
512 |
|
509 | header = INDEX_HEADER.unpack(entry_data[:4])[0] | ||
513 | supported_flags = SUPPORTED_FLAGS.get(self._format_version) |
|
510 | self._initempty = False | |
514 | if supported_flags is None: |
|
|||
515 | msg = _(b'unknown version (%d) in revlog %s') |
|
|||
516 | msg %= (self._format_version, self.display_id) |
|
|||
517 | raise error.RevlogError(msg) |
|
|||
518 | elif self._format_flags & ~supported_flags: |
|
|||
519 | msg = _(b'unknown flags (%#04x) in version %d revlog %s') |
|
|||
520 | display_flag = self._format_flags >> 16 |
|
|||
521 | msg %= (display_flag, self._format_version, self.display_id) |
|
|||
522 | raise error.RevlogError(msg) |
|
|||
523 |
|
||||
524 | features = FEATURES_BY_VERSION[self._format_version] |
|
|||
525 | self._inline = features[b'inline'](self._format_flags) |
|
|||
526 | self._generaldelta = features[b'generaldelta'](self._format_flags) |
|
|||
527 | self.hassidedata = features[b'sidedata'] |
|
|||
528 |
|
||||
529 | if not features[b'docket']: |
|
|||
530 | self._indexfile = entry_point |
|
|||
531 | index_data = entry_data |
|
|||
532 | else: |
|
|||
533 | self._docket_file = entry_point |
|
|||
534 | if self._initempty: |
|
|||
535 | self._docket = docketutil.default_docket(self, header) |
|
|||
536 | else: |
|
511 | else: | |
537 | self._docket = docketutil.parse_docket( |
|
512 | header = new_header | |
538 | self, entry_data, use_pending=self._trypending |
|
513 | ||
539 | ) |
|
514 | self._format_flags = header & ~0xFFFF | |
|
515 | self._format_version = header & 0xFFFF | |||
|
516 | ||||
|
517 | supported_flags = SUPPORTED_FLAGS.get(self._format_version) | |||
|
518 | if supported_flags is None: | |||
|
519 | msg = _(b'unknown version (%d) in revlog %s') | |||
|
520 | msg %= (self._format_version, self.display_id) | |||
|
521 | raise error.RevlogError(msg) | |||
|
522 | elif self._format_flags & ~supported_flags: | |||
|
523 | msg = _(b'unknown flags (%#04x) in version %d revlog %s') | |||
|
524 | display_flag = self._format_flags >> 16 | |||
|
525 | msg %= (display_flag, self._format_version, self.display_id) | |||
|
526 | raise error.RevlogError(msg) | |||
|
527 | ||||
|
528 | features = FEATURES_BY_VERSION[self._format_version] | |||
|
529 | self._inline = features[b'inline'](self._format_flags) | |||
|
530 | self._generaldelta = features[b'generaldelta'](self._format_flags) | |||
|
531 | self.hassidedata = features[b'sidedata'] | |||
|
532 | ||||
|
533 | if not features[b'docket']: | |||
|
534 | self._indexfile = entry_point | |||
|
535 | index_data = entry_data | |||
|
536 | else: | |||
|
537 | self._docket_file = entry_point | |||
|
538 | if self._initempty: | |||
|
539 | self._docket = docketutil.default_docket(self, header) | |||
|
540 | else: | |||
|
541 | self._docket = docketutil.parse_docket( | |||
|
542 | self, entry_data, use_pending=self._trypending | |||
|
543 | ) | |||
|
544 | ||||
|
545 | if self._docket is not None: | |||
540 | self._indexfile = self._docket.index_filepath() |
|
546 | self._indexfile = self._docket.index_filepath() | |
541 | index_data = b'' |
|
547 | index_data = b'' | |
542 | index_size = self._docket.index_end |
|
548 | index_size = self._docket.index_end |
General Comments 0
You need to be logged in to leave comments.
Login now