Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 51085:31f143448704
revlog: drop reference to docket in the inline-splitting code
revlog with a docket do not use inline revlog and do not need to split them. So
we can remove some code handling docket there.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 19 Oct 2023 01:50:07 +0200 |
parents | df50a1592e0c |
children | c2c24b6b97f5 |
comparison
equal
deleted
inserted
replaced
51084:df50a1592e0c | 51085:31f143448704 |
---|---|
2561 tiprev = len(self) - 1 | 2561 tiprev = len(self) - 1 |
2562 total_size = self.start(tiprev) + self.length(tiprev) | 2562 total_size = self.start(tiprev) + self.length(tiprev) |
2563 if not self._inline or total_size < _maxinline: | 2563 if not self._inline or total_size < _maxinline: |
2564 return | 2564 return |
2565 | 2565 |
2566 if self._docket is not None: | |
2567 msg = b"inline revlog should not have a docket" | |
2568 raise error.ProgrammingError(msg) | |
2569 | |
2566 troffset = tr.findoffset(self._indexfile) | 2570 troffset = tr.findoffset(self._indexfile) |
2567 if troffset is None: | 2571 if troffset is None: |
2568 raise error.RevlogError( | 2572 raise error.RevlogError( |
2569 _(b"%s not found in the transaction") % self._indexfile | 2573 _(b"%s not found in the transaction") % self._indexfile |
2570 ) | 2574 ) |
2632 self._format_flags &= ~FLAG_INLINE_DATA | 2636 self._format_flags &= ~FLAG_INLINE_DATA |
2633 self._inline = False | 2637 self._inline = False |
2634 self._inner.inline = False | 2638 self._inner.inline = False |
2635 for i in self: | 2639 for i in self: |
2636 e = self.index.entry_binary(i) | 2640 e = self.index.entry_binary(i) |
2637 if i == 0 and self._docket is None: | 2641 if i == 0: |
2638 header = self._format_flags | self._format_version | 2642 header = self._format_flags | self._format_version |
2639 header = self.index.pack_header(header) | 2643 header = self.index.pack_header(header) |
2640 e = header + e | 2644 e = header + e |
2641 fp.write(e) | 2645 fp.write(e) |
2642 if self._docket is not None: | |
2643 self._docket.index_end = fp.tell() | |
2644 | 2646 |
2645 # If we don't use side-write, the temp file replace the real | 2647 # If we don't use side-write, the temp file replace the real |
2646 # index when we exit the context manager | 2648 # index when we exit the context manager |
2647 | 2649 |
2648 nodemaputil.setup_persistent_nodemap(tr, self) | 2650 nodemaputil.setup_persistent_nodemap(tr, self) |
2653 ) | 2655 ) |
2654 | 2656 |
2655 if existing_handles: | 2657 if existing_handles: |
2656 # switched from inline to conventional reopen the index | 2658 # switched from inline to conventional reopen the index |
2657 index_end = None | 2659 index_end = None |
2658 if self._docket is not None: | |
2659 index_end = self._docket.index_end | |
2660 ifh = self._inner._InnerRevlog__index_write_fp( | 2660 ifh = self._inner._InnerRevlog__index_write_fp( |
2661 index_end=index_end | 2661 index_end=index_end |
2662 ) | 2662 ) |
2663 self._inner._writinghandles = (ifh, new_dfh, None) | 2663 self._inner._writinghandles = (ifh, new_dfh, None) |
2664 self._inner._segmentfile.writing_handle = new_dfh | 2664 self._inner._segmentfile.writing_handle = new_dfh |