Skip to content

Commit

Permalink
ololo
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop committed Oct 23, 2023
1 parent e2f5f74 commit 705616a
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions dvc/repo/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,31 @@
from dvc_objects.db import ObjectDB


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

stages = set()
for remote_name, idx in worktree_view_by_remotes(index):
remote = index.repo.cloud.get_remote(remote_name)

new = build_data_index(idx, remote.path, remote.fs)

for out in idx.outs:
if (
not idx.data["repo"]
.storage_map[out.index_key[1]]
.remote.fs.version_aware
):
continue

_merge_push_meta(out, new)
stages.add(out.stage)

for stage in stages:
stage.dump(with_files=True, update_pipeline=False)


@locked
def push( # noqa: C901, PLR0913
self,
Expand Down Expand Up @@ -71,8 +96,6 @@ def push( # noqa: C901, PLR0913
cache_key=cache_key,
callback=cb,
)
# data, unversioned_count = _log_unversioned(data)
# failed_count += unversioned_count

with Callback.as_tqdm_callback(
desc="Pushing",
Expand All @@ -87,30 +110,11 @@ def push( # noqa: C901, PLR0913
finally:
ws_idx = indexes.get("workspace")
if ws_idx is not None:
from dvc.repo.worktree import _merge_push_meta

stages = set()
for out in ws_idx.outs:
if (
not ws_idx.data["repo"]
.storage_map[out.index_key[1]]
.remote.fs.version_aware
):
continue

_merge_push_meta(out, ws_idx.data["repo"])
stages.add(out.stage)

for stage in stages:
stage.dump(with_files=True, update_pipeline=False)
_update_meta(self.index) # fixme this should be targets_view

for fs_index in data:
fs_index.close()

# if fetch_transferred:
# # NOTE: dropping cached index to force reloading from newly saved cache
# self.drop_data_index()

transferred_count += push_transferred
failed_count += push_failed
if failed_count:
Expand Down

0 comments on commit 705616a

Please sign in to comment.