Skip to content

Commit

Permalink
push: only collect needed files when updating version_ids
Browse files Browse the repository at this point in the history
efiop committed Dec 22, 2023
1 parent 19f2246 commit 01f49b7
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions dvc/repo/push.py
Original file line number Diff line number Diff line change
@@ -6,8 +6,31 @@
from . import locked


def _rebuild(idx, path, fs, cb):
from dvc_data.index import DataIndex, DataIndexEntry, Meta

new = DataIndex()
items = list(idx.items())

cb.set_total(len(items))
for key, entry in items:
if entry.meta and entry.meta.isdir:
meta = Meta(isdir=True)
else:
try:
meta = Meta.from_info(fs.info(fs.join(path, *key)), fs.protocol)
except FileNotFoundError:
meta = None

if meta:
new.add(DataIndexEntry(key=key, meta=meta))

cb.relative_update(1)

return new


def _update_meta(index, **kwargs):
from dvc.repo.index import build_data_index
from dvc.repo.worktree import _merge_push_meta, worktree_view_by_remotes

stages = set()
@@ -19,12 +42,8 @@ def _update_meta(index, **kwargs):
unit="entry",
leave=True,
) as pb:
new = build_data_index(
idx,
remote.path,
remote.fs,
callback=pb.as_callback(),
)
cb = pb.as_callback()
new = _rebuild(idx.data["repo"], remote.path, remote.fs, cb)

for out in idx.outs:
if not remote.fs.version_aware:

0 comments on commit 01f49b7

Please sign in to comment.