From 2748492f6b2ee9e91f56fe64ec78505ae3ee8e63 Mon Sep 17 00:00:00 2001 From: Peter Rowlands Date: Tue, 22 Nov 2022 17:53:35 +0900 Subject: [PATCH] worktree push: don't push existing versions --- dvc/repo/worktree.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dvc/repo/worktree.py b/dvc/repo/worktree.py index 6b80caac2..0b3f5cadb 100644 --- a/dvc/repo/worktree.py +++ b/dvc/repo/worktree.py @@ -30,7 +30,11 @@ def worktree_view( return True def outs_filter(out: "Output") -> bool: - if not out.is_in_repo or (push and not out.can_push): + if ( + not out.is_in_repo + or not out.use_cache + or (push and not out.can_push) + ): return False return True @@ -53,8 +57,7 @@ def fetch_worktree(repo: "Repo", remote: "Remote") -> int: remote.path, *key, ) - save(index) - return len(index) + return save(index) def push_worktree(repo: "Repo", remote: "Remote") -> int: @@ -63,7 +66,7 @@ def push_worktree(repo: "Repo", remote: "Remote") -> int: view = worktree_view(repo.index, push=True) index = view.data["repo"] - checkout(index, remote.path, remote.fs) + pushed = checkout(index, remote.path, remote.fs, latest_only=False) for stage in view.stages: for out in stage.outs: @@ -97,4 +100,4 @@ def push_worktree(repo: "Repo", remote: "Remote") -> int: out.meta = entry.meta stage.dvcfile.dump(stage, with_files=True, update_pipeline=False) - return len(index) + return pushed