28 lines
1001 B
Python
28 lines
1001 B
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
class CommentFlagMigrationService:
|
|
def migrate(self, session_dir: Path) -> dict[str, int]:
|
|
migrated_split_flags = 0
|
|
legacy_untracked_full = 0
|
|
if not session_dir.exists():
|
|
return {"migrated_split_flags": 0, "legacy_untracked_full": 0}
|
|
|
|
for folder in sorted(p for p in session_dir.iterdir() if p.is_dir()):
|
|
comment_done = folder / "comment_done.flag"
|
|
split_done = folder / "comment_split_done.flag"
|
|
full_done = folder / "comment_full_done.flag"
|
|
if not comment_done.exists():
|
|
continue
|
|
if not split_done.exists():
|
|
split_done.touch()
|
|
migrated_split_flags += 1
|
|
if not full_done.exists():
|
|
legacy_untracked_full += 1
|
|
return {
|
|
"migrated_split_flags": migrated_split_flags,
|
|
"legacy_untracked_full": legacy_untracked_full,
|
|
}
|