detect file moves in sync

This commit is contained in:
phernandez
2025-01-13 23:01:39 -06:00
parent ef13b3b30a
commit dd7a9da3e4
6 changed files with 184 additions and 22 deletions
+3 -1
View File
@@ -12,14 +12,16 @@ class SyncReport:
new: Files that exist on disk but not in database
modified: Files that exist in both but have different checksums
deleted: Files that exist in database but not on disk
moves: Files that have been moved from one location to another
checksums: Current checksums for files on disk
"""
new: Set[str] = field(default_factory=set)
modified: Set[str] = field(default_factory=set)
deleted: Set[str] = field(default_factory=set)
moves: Dict[str, str] = field(default_factory=dict) # old_path -> new_path
checksums: Dict[str, str] = field(default_factory=dict)
@property
def total_changes(self) -> int:
"""Total number of files that need attention."""
return len(self.new) + len(self.modified) + len(self.deleted)
return len(self.new) + len(self.modified) + len(self.deleted) + len(self.moves)