mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-12 15:28:21 +01:00
* dvctree: use string paths for performance reasons in _get_granular_checksum() * dvctree: cache most recently accessed metadata * dvctree: cache output dir cache during walk() calls * diff: use get_file_hash directly instead of get_hash when appropriate * dvctree: cache most recen dir_cache hashes in _get_granular_checksum * revert metadata cache changes - mostly unnecessary after granular checksum changes, will be better addressed by the future exception handling updates * fix windows path issue * HashInfo: store HashInfo.dir_info as a dict instead of list * DvcTree: use hash_info.dir_info for getting granular file hashes * use str relpath * use correct dir_info hash type * fix windows paths
30 lines
618 B
Python
30 lines
618 B
Python
from dataclasses import dataclass, field
|
|
|
|
HASH_DIR_SUFFIX = ".dir"
|
|
|
|
|
|
@dataclass
|
|
class HashInfo:
|
|
name: str
|
|
value: str
|
|
dir_info: dict = field(default=None, compare=False)
|
|
|
|
def __bool__(self):
|
|
return bool(self.value)
|
|
|
|
@classmethod
|
|
def from_dict(cls, d):
|
|
if not d:
|
|
return cls(None, None)
|
|
((name, value),) = d.items()
|
|
return cls(name, value)
|
|
|
|
def to_dict(self):
|
|
return {self.name: self.value} if self else {}
|
|
|
|
@property
|
|
def isdir(self):
|
|
if not self:
|
|
return False
|
|
return self.value.endswith(HASH_DIR_SUFFIX)
|