Show More
@@ -162,11 +162,8 def onetimesetup(ui): | |||
|
162 | 162 | ): |
|
163 | 163 | n = util.pconvert(fp[striplen:]) |
|
164 | 164 | d = store.decodedir(n) |
|
165 | yield store.StoreEntry( | |
|
165 | yield store.SimpleStoreEntry( | |
|
166 | 166 | unencoded_path=d, |
|
167 | is_revlog=True, | |
|
168 | revlog_type=None, | |
|
169 | is_revlog_main=False, | |
|
170 | 167 | is_volatile=False, |
|
171 | 168 | file_size=st.st_size, |
|
172 | 169 | ) |
@@ -454,15 +454,12 FILETYPE_OTHER = FILEFLAGS_OTHER | |||
|
454 | 454 | |
|
455 | 455 | |
|
456 | 456 | @attr.s(slots=True) |
|
457 | class StoreEntry: | |
|
457 | class BaseStoreEntry: | |
|
458 | 458 | """An entry in the store |
|
459 | 459 | |
|
460 | 460 | This is returned by `store.walk` and represent some data in the store.""" |
|
461 | 461 | |
|
462 | 462 | unencoded_path = attr.ib() |
|
463 | is_revlog = attr.ib(default=False) | |
|
464 | revlog_type = attr.ib(default=None) | |
|
465 | is_revlog_main = attr.ib(default=None) | |
|
466 | 463 | is_volatile = attr.ib(default=False) |
|
467 | 464 | file_size = attr.ib(default=None) |
|
468 | 465 | |
@@ -477,6 +474,22 class StoreEntry: | |||
|
477 | 474 | |
|
478 | 475 | |
|
479 | 476 | @attr.s(slots=True) |
|
477 | class SimpleStoreEntry(BaseStoreEntry): | |
|
478 | """A generic entry in the store""" | |
|
479 | ||
|
480 | is_revlog = False | |
|
481 | ||
|
482 | ||
|
483 | @attr.s(slots=True) | |
|
484 | class RevlogStoreEntry(BaseStoreEntry): | |
|
485 | """A revlog entry in the store""" | |
|
486 | ||
|
487 | is_revlog = True | |
|
488 | revlog_type = attr.ib(default=None) | |
|
489 | is_revlog_main = attr.ib(default=None) | |
|
490 | ||
|
491 | ||
|
492 | @attr.s(slots=True) | |
|
480 | 493 | class StoreFile: |
|
481 | 494 | """a file matching an entry""" |
|
482 | 495 | |
@@ -536,7 +549,7 class basicstore: | |||
|
536 | 549 | |
|
537 | 550 | def datafiles( |
|
538 | 551 | self, matcher=None, undecodable=None |
|
539 | ) -> Generator[StoreEntry, None, None]: | |
|
552 | ) -> Generator[BaseStoreEntry, None, None]: | |
|
540 | 553 | """Like walk, but excluding the changelog and root manifest. |
|
541 | 554 | |
|
542 | 555 | When [undecodable] is None, revlogs names that can't be |
@@ -546,35 +559,42 class basicstore: | |||
|
546 | 559 | files = self._walk(b'data', True) + self._walk(b'meta', True) |
|
547 | 560 | for (t, u, s) in files: |
|
548 | 561 | if t is not None: |
|
549 | yield StoreEntry( | |
|
562 | yield RevlogStoreEntry( | |
|
550 | 563 | unencoded_path=u, |
|
551 | is_revlog=True, | |
|
552 | 564 | revlog_type=FILEFLAGS_FILELOG, |
|
553 | 565 | is_revlog_main=bool(t & FILEFLAGS_REVLOG_MAIN), |
|
554 | 566 | is_volatile=bool(t & FILEFLAGS_VOLATILE), |
|
555 | 567 | file_size=s, |
|
556 | 568 | ) |
|
557 | 569 | |
|
558 | def topfiles(self) -> Generator[StoreEntry, None, None]: | |
|
570 | def topfiles(self) -> Generator[BaseStoreEntry, None, None]: | |
|
559 | 571 | # yield manifest before changelog |
|
560 | 572 | files = reversed(self._walk(b'', False)) |
|
561 | 573 | for (t, u, s) in files: |
|
562 | 574 | if u.startswith(b'00changelog'): |
|
563 | revlog_type = FILEFLAGS_CHANGELOG | |
|
575 | yield RevlogStoreEntry( | |
|
576 | unencoded_path=u, | |
|
577 | revlog_type=FILEFLAGS_CHANGELOG, | |
|
578 | is_revlog_main=bool(t & FILEFLAGS_REVLOG_MAIN), | |
|
579 | is_volatile=bool(t & FILEFLAGS_VOLATILE), | |
|
580 | file_size=s, | |
|
581 | ) | |
|
564 | 582 | elif u.startswith(b'00manifest'): |
|
565 | revlog_type = FILEFLAGS_MANIFESTLOG | |
|
583 | yield RevlogStoreEntry( | |
|
584 | unencoded_path=u, | |
|
585 | revlog_type=FILEFLAGS_MANIFESTLOG, | |
|
586 | is_revlog_main=bool(t & FILEFLAGS_REVLOG_MAIN), | |
|
587 | is_volatile=bool(t & FILEFLAGS_VOLATILE), | |
|
588 | file_size=s, | |
|
589 | ) | |
|
566 | 590 | else: |
|
567 | revlog_type = None | |
|
568 | yield StoreEntry( | |
|
569 | unencoded_path=u, | |
|
570 | is_revlog=revlog_type is not None, | |
|
571 | revlog_type=revlog_type, | |
|
572 | is_revlog_main=bool(t & FILEFLAGS_REVLOG_MAIN), | |
|
573 | is_volatile=bool(t & FILEFLAGS_VOLATILE), | |
|
574 | file_size=s, | |
|
575 | ) | |
|
591 | yield SimpleStoreEntry( | |
|
592 | unencoded_path=u, | |
|
593 | is_volatile=bool(t & FILEFLAGS_VOLATILE), | |
|
594 | file_size=s, | |
|
595 | ) | |
|
576 | 596 | |
|
577 | def walk(self, matcher=None) -> Generator[StoreEntry, None, None]: | |
|
597 | def walk(self, matcher=None) -> Generator[BaseStoreEntry, None, None]: | |
|
578 | 598 | """return files related to data storage (ie: revlogs) |
|
579 | 599 | |
|
580 | 600 | yields (file_type, unencoded, size) |
@@ -629,7 +649,7 class encodedstore(basicstore): | |||
|
629 | 649 | |
|
630 | 650 | def datafiles( |
|
631 | 651 | self, matcher=None, undecodable=None |
|
632 | ) -> Generator[StoreEntry, None, None]: | |
|
652 | ) -> Generator[BaseStoreEntry, None, None]: | |
|
633 | 653 | for entry in super(encodedstore, self).datafiles(): |
|
634 | 654 | try: |
|
635 | 655 | f1 = entry.unencoded_path |
@@ -842,7 +862,7 class fncachestore(basicstore): | |||
|
842 | 862 | |
|
843 | 863 | def datafiles( |
|
844 | 864 | self, matcher=None, undecodable=None |
|
845 | ) -> Generator[StoreEntry, None, None]: | |
|
865 | ) -> Generator[BaseStoreEntry, None, None]: | |
|
846 | 866 | for f in sorted(self.fncache): |
|
847 | 867 | if not _matchtrackedpath(f, matcher): |
|
848 | 868 | continue |
@@ -854,11 +874,9 class fncachestore(basicstore): | |||
|
854 | 874 | # However the fncache might contains such file added by |
|
855 | 875 | # previous version of Mercurial. |
|
856 | 876 | continue |
|
857 | t |= FILEFLAGS_FILELOG | |
|
858 | 877 | try: |
|
859 | yield StoreEntry( | |
|
878 | yield RevlogStoreEntry( | |
|
860 | 879 | unencoded_path=f, |
|
861 | is_revlog=True, | |
|
862 | 880 | revlog_type=FILEFLAGS_FILELOG, |
|
863 | 881 | is_revlog_main=bool(t & FILEFLAGS_REVLOG_MAIN), |
|
864 | 882 | is_volatile=bool(t & FILEFLAGS_VOLATILE), |
General Comments 0
You need to be logged in to leave comments.
Login now