Skip to content

Commit 6301414

Browse files
authored
gc: log paths during dry-run (#650)
1 parent d440a37 commit 6301414

File tree

1 file changed

+8
-2
lines changed
  • src/dvc_data/hashfile

1 file changed

+8
-2
lines changed

src/dvc_data/hashfile/gc.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
import logging
12
from collections.abc import Iterable
23
from typing import TYPE_CHECKING, Optional
34

45
if TYPE_CHECKING:
56
from .db import HashFileDB
67
from .hash_info import HashInfo
78

9+
logger = logging.getLogger(__name__)
810

9-
def gc( # noqa: C901
11+
12+
def gc( # noqa: C901, PLR0912
1013
odb: "HashFileDB",
1114
used: Iterable["HashInfo"],
1215
jobs: Optional[int] = None,
@@ -55,7 +58,10 @@ def _is_dir_hash(_hash):
5558
for paths in (dir_paths, file_paths):
5659
if paths:
5760
num_removed += len(paths)
58-
if not dry:
61+
if dry:
62+
for path in paths:
63+
logger.info("Removing %s", path)
64+
else:
5965
odb.fs.remove(paths)
6066

6167
return num_removed

0 commit comments

Comments
 (0)