##// END OF EJS Templates
store: have custom init for entries class...
marmoute -
r51367:c37450a5 default
parent child Browse files
Show More
@@ -453,7 +453,7 b' FILETYPE_FILELOG_OTHER = FILEFLAGS_FILEL'
453 FILETYPE_OTHER = FILEFLAGS_OTHER
453 FILETYPE_OTHER = FILEFLAGS_OTHER
454
454
455
455
456 @attr.s(slots=True)
456 @attr.s(slots=True, init=False)
457 class BaseStoreEntry:
457 class BaseStoreEntry:
458 """An entry in the store
458 """An entry in the store
459
459
@@ -463,6 +463,16 b' class BaseStoreEntry:'
463 is_volatile = attr.ib(default=False)
463 is_volatile = attr.ib(default=False)
464 file_size = attr.ib(default=None)
464 file_size = attr.ib(default=None)
465
465
466 def __init__(
467 self,
468 unencoded_path,
469 is_volatile=False,
470 file_size=None,
471 ):
472 self.unencoded_path = unencoded_path
473 self.is_volatile = is_volatile
474 self.file_size = file_size
475
466 def files(self):
476 def files(self):
467 return [
477 return [
468 StoreFile(
478 StoreFile(
@@ -473,14 +483,14 b' class BaseStoreEntry:'
473 ]
483 ]
474
484
475
485
476 @attr.s(slots=True)
486 @attr.s(slots=True, init=False)
477 class SimpleStoreEntry(BaseStoreEntry):
487 class SimpleStoreEntry(BaseStoreEntry):
478 """A generic entry in the store"""
488 """A generic entry in the store"""
479
489
480 is_revlog = False
490 is_revlog = False
481
491
482
492
483 @attr.s(slots=True)
493 @attr.s(slots=True, init=False)
484 class RevlogStoreEntry(BaseStoreEntry):
494 class RevlogStoreEntry(BaseStoreEntry):
485 """A revlog entry in the store"""
495 """A revlog entry in the store"""
486
496
@@ -488,6 +498,22 b' class RevlogStoreEntry(BaseStoreEntry):'
488 revlog_type = attr.ib(default=None)
498 revlog_type = attr.ib(default=None)
489 is_revlog_main = attr.ib(default=None)
499 is_revlog_main = attr.ib(default=None)
490
500
501 def __init__(
502 self,
503 unencoded_path,
504 revlog_type,
505 is_revlog_main=False,
506 is_volatile=False,
507 file_size=None,
508 ):
509 super().__init__(
510 unencoded_path=unencoded_path,
511 is_volatile=is_volatile,
512 file_size=file_size,
513 )
514 self.revlog_type = revlog_type
515 self.is_revlog_main = is_revlog_main
516
491
517
492 @attr.s(slots=True)
518 @attr.s(slots=True)
493 class StoreFile:
519 class StoreFile:
General Comments 0
You need to be logged in to leave comments. Login now