Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions dvc/dependency/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,9 @@ def update(self, rev=None):

with self._make_repo(locked=False) as repo:
self.def_repo[self.PARAM_REV_LOCK] = repo.get_rev()

def changed_checksum(self):
# From current repo point of view what describes RepoDependency is its
# origin project url and rev_lock, and it makes RepoDependency
# immutable, hence its impossible for checksum to change.
return False
4 changes: 3 additions & 1 deletion dvc/tree/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@ def is_dir_hash(cls, hash_):
return hash_.endswith(cls.CHECKSUM_DIR_SUFFIX)

def get_hash(self, path_info, tree=None, **kwargs):
assert isinstance(path_info, str) or path_info.scheme == self.scheme
assert path_info and (
isinstance(path_info, str) or path_info.scheme == self.scheme
)

if not tree:
tree = self
Expand Down
12 changes: 12 additions & 0 deletions tests/func/test_commit.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from os import fspath

import pytest

from dvc.dvcfile import PIPELINE_FILE
Expand Down Expand Up @@ -95,3 +97,13 @@ def test_commit_pipeline_stage(tmp_dir, dvc, run_copy):
assert dvc.commit(f":{stage.addressing}") == [stage]
assert dvc.commit(f"{PIPELINE_FILE}:{stage.addressing}") == [stage]
assert dvc.commit(PIPELINE_FILE) == [stage]


def test_imported_entries_unchanged(tmp_dir, dvc, erepo_dir):
with erepo_dir.chdir():
erepo_dir.dvc_gen("file", "file content", "initial commit")

stage = dvc.imp(fspath(erepo_dir), "file")

with dvc.state:
assert stage.changed_entries() == ([], [], None)
Comment on lines +108 to +109
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't it show up on dvc.status?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC these are not used by status but by commit to show prompt message on what's changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skshetry is right, in case of commit we check whether changed_checksum for RepoDependency changed. Upon status, we actually get the checksum for the file from the external repo, to get information on whether it has been updated.