Show More
@@ -448,9 +448,7 b' def manifestrevlogs(repo):' | |||
|
448 | 448 | for entry in repo.store.datafiles(): |
|
449 | 449 | if not entry.is_revlog: |
|
450 | 450 | continue |
|
451 |
if |
|
|
452 | continue | |
|
453 | if entry.is_revlog_main: | |
|
451 | if entry.revlog_type == store.FILEFLAGS_MANIFESTLOG: | |
|
454 | 452 | yield repo.manifestlog.getstorage(entry.target_id) |
|
455 | 453 | |
|
456 | 454 |
@@ -828,9 +828,7 b' def repair_issue6528(' | |||
|
828 | 828 | entry |
|
829 | 829 | for entry in repo.store.datafiles() |
|
830 | 830 | if ( |
|
831 | entry.is_revlog | |
|
832 | and entry.is_revlog_main | |
|
833 | and entry.revlog_type == store.FILEFLAGS_FILELOG | |
|
831 | entry.is_revlog and entry.revlog_type == store.FILEFLAGS_FILELOG | |
|
834 | 832 | ) |
|
835 | 833 | ) |
|
836 | 834 |
@@ -464,6 +464,13 b' class BaseStoreEntry:' | |||
|
464 | 464 | |
|
465 | 465 | This is returned by `store.walk` and represent some data in the store.""" |
|
466 | 466 | |
|
467 | ||
|
468 | @attr.s(slots=True, init=False) | |
|
469 | class SimpleStoreEntry(BaseStoreEntry): | |
|
470 | """A generic entry in the store""" | |
|
471 | ||
|
472 | is_revlog = False | |
|
473 | ||
|
467 | 474 | _entry_path = attr.ib() |
|
468 | 475 | _is_volatile = attr.ib(default=False) |
|
469 | 476 | _file_size = attr.ib(default=None) |
@@ -474,6 +481,7 b' class BaseStoreEntry:' | |||
|
474 | 481 | is_volatile=False, |
|
475 | 482 | file_size=None, |
|
476 | 483 | ): |
|
484 | super().__init__() | |
|
477 | 485 | self._entry_path = entry_path |
|
478 | 486 | self._is_volatile = is_volatile |
|
479 | 487 | self._file_size = file_size |
@@ -489,42 +497,41 b' class BaseStoreEntry:' | |||
|
489 | 497 | |
|
490 | 498 | |
|
491 | 499 | @attr.s(slots=True, init=False) |
|
492 | class SimpleStoreEntry(BaseStoreEntry): | |
|
493 | """A generic entry in the store""" | |
|
494 | ||
|
495 | is_revlog = False | |
|
496 | ||
|
497 | ||
|
498 | @attr.s(slots=True, init=False) | |
|
499 | 500 | class RevlogStoreEntry(BaseStoreEntry): |
|
500 | 501 | """A revlog entry in the store""" |
|
501 | 502 | |
|
502 | 503 | is_revlog = True |
|
504 | ||
|
503 | 505 | revlog_type = attr.ib(default=None) |
|
504 | 506 | target_id = attr.ib(default=None) |
|
505 |
|
|
|
507 | _path_prefix = attr.ib(default=None) | |
|
508 | _details = attr.ib(default=None) | |
|
506 | 509 | |
|
507 | 510 | def __init__( |
|
508 | 511 | self, |
|
509 | entry_path, | |
|
510 | 512 | revlog_type, |
|
513 | path_prefix, | |
|
511 | 514 | target_id, |
|
512 |
|
|
|
513 | is_volatile=False, | |
|
514 | file_size=None, | |
|
515 | details, | |
|
515 | 516 | ): |
|
516 | super().__init__( | |
|
517 | entry_path=entry_path, | |
|
518 | is_volatile=is_volatile, | |
|
519 | file_size=file_size, | |
|
520 | ) | |
|
517 | super().__init__() | |
|
521 | 518 | self.revlog_type = revlog_type |
|
522 | 519 | self.target_id = target_id |
|
523 | self.is_revlog_main = is_revlog_main | |
|
520 | self._path_prefix = path_prefix | |
|
521 | assert b'.i' in details, (path_prefix, details) | |
|
522 | self._details = details | |
|
524 | 523 | |
|
525 | 524 | def main_file_path(self): |
|
526 | 525 | """unencoded path of the main revlog file""" |
|
527 |
return self. |
|
|
526 | return self._path_prefix + b'.i' | |
|
527 | ||
|
528 | def files(self): | |
|
529 | files = [] | |
|
530 | for ext in sorted(self._details, key=_ext_key): | |
|
531 | path = self._path_prefix + ext | |
|
532 | data = self._details[ext] | |
|
533 | files.append(StoreFile(unencoded_path=path, **data)) | |
|
534 | return files | |
|
528 | 535 | |
|
529 | 536 | |
|
530 | 537 | @attr.s(slots=True) |
@@ -532,7 +539,7 b' class StoreFile:' | |||
|
532 | 539 | """a file matching an entry""" |
|
533 | 540 | |
|
534 | 541 | unencoded_path = attr.ib() |
|
535 |
_file_size = attr.ib(default= |
|
|
542 | _file_size = attr.ib(default=None) | |
|
536 | 543 | is_volatile = attr.ib(default=False) |
|
537 | 544 | |
|
538 | 545 | def file_size(self, vfs): |
@@ -652,16 +659,18 b' class basicstore:' | |||
|
652 | 659 | files = self._walk(base_dir, True, undecodable=undecodable) |
|
653 | 660 | files = (f for f in files if f[1][0] is not None) |
|
654 | 661 | for revlog, details in _gather_revlog(files): |
|
655 | for ext, (t, s) in sorted(details.items()): | |
|
656 | u = revlog + ext | |
|
662 | file_details = {} | |
|
657 | 663 |
|
|
664 | for ext, (t, s) in sorted(details.items()): | |
|
665 | file_details[ext] = { | |
|
666 | 'is_volatile': bool(t & FILEFLAGS_VOLATILE), | |
|
667 | 'file_size': s, | |
|
668 | } | |
|
658 | 669 |
|
|
659 |
|
|
|
670 | path_prefix=revlog, | |
|
660 | 671 |
|
|
661 | 672 |
|
|
662 | is_revlog_main=bool(t & FILEFLAGS_REVLOG_MAIN), | |
|
663 | is_volatile=bool(t & FILEFLAGS_VOLATILE), | |
|
664 | file_size=s, | |
|
673 | details=file_details, | |
|
665 | 674 |
|
|
666 | 675 | |
|
667 | 676 | def topfiles(self) -> Generator[BaseStoreEntry, None, None]: |
@@ -692,17 +701,17 b' class basicstore:' | |||
|
692 | 701 | assert len(changelogs) <= 1 |
|
693 | 702 | for data, revlog_type in top_rl: |
|
694 | 703 | for revlog, details in sorted(data.items()): |
|
695 | # (keeping ordering so we get 00changelog.i last) | |
|
696 | key = lambda x: _ext_key(x[0]) | |
|
697 | for ext, (t, s) in sorted(details.items(), key=key): | |
|
698 | u = revlog + ext | |
|
704 | file_details = {} | |
|
705 | for ext, (t, s) in details.items(): | |
|
706 | file_details[ext] = { | |
|
707 | 'is_volatile': bool(t & FILEFLAGS_VOLATILE), | |
|
708 | 'file_size': s, | |
|
709 | } | |
|
699 | 710 |
|
|
700 |
|
|
|
711 | path_prefix=revlog, | |
|
701 | 712 |
|
|
702 | 713 |
|
|
703 | is_revlog_main=bool(t & FILEFLAGS_REVLOG_MAIN), | |
|
704 | is_volatile=bool(t & FILEFLAGS_VOLATILE), | |
|
705 | file_size=s, | |
|
714 | details=file_details, | |
|
706 | 715 |
|
|
707 | 716 | |
|
708 | 717 | def walk(self, matcher=None) -> Generator[BaseStoreEntry, None, None]: |
@@ -981,6 +990,7 b' class fncachestore(basicstore):' | |||
|
981 | 990 | files = (f for f in files if f[1] is not None) |
|
982 | 991 | by_revlog = _gather_revlog(files) |
|
983 | 992 | for revlog, details in by_revlog: |
|
993 | file_details = {} | |
|
984 | 994 | if revlog.startswith(b'data/'): |
|
985 | 995 | rl_type = FILEFLAGS_FILELOG |
|
986 | 996 | revlog_target_id = revlog.split(b'/', 1)[1] |
@@ -992,14 +1002,15 b' class fncachestore(basicstore):' | |||
|
992 | 1002 | else: |
|
993 | 1003 | # unreachable |
|
994 | 1004 | assert False, revlog |
|
995 |
for ext, t in |
|
|
996 | f = revlog + ext | |
|
1005 | for ext, t in details.items(): | |
|
1006 | file_details[ext] = { | |
|
1007 | 'is_volatile': bool(t & FILEFLAGS_VOLATILE), | |
|
1008 | } | |
|
997 | 1009 |
|
|
998 |
|
|
|
1010 | path_prefix=revlog, | |
|
999 | 1011 |
|
|
1000 | 1012 |
|
|
1001 | is_revlog_main=bool(t & FILEFLAGS_REVLOG_MAIN), | |
|
1002 | is_volatile=bool(t & FILEFLAGS_VOLATILE), | |
|
1013 | details=file_details, | |
|
1003 | 1014 |
|
|
1004 | 1015 |
|
|
1005 | 1016 |
|
@@ -194,7 +194,7 b' def _clonerevlogs(' | |||
|
194 | 194 | # Perform a pass to collect metadata. This validates we can open all |
|
195 | 195 | # source files and allows a unified progress bar to be displayed. |
|
196 | 196 | for entry in alldatafiles: |
|
197 |
if not |
|
|
197 | if not entry.is_revlog: | |
|
198 | 198 | continue |
|
199 | 199 | |
|
200 | 200 | rl = _revlog_from_store_entry(srcrepo, entry) |
General Comments 0
You need to be logged in to leave comments.
Login now