RepoTree: work with dirty repos (#4005)

Currently `RepoTree.open` will throw FileNotFoundError if you have a
file that is tracked by dvc, but which has no md5 or a cache for which
is missing, even though you have the file itself in your workspace.

This corresponds very nicely to the `--no-commit` or `--no-exec`
scenario, where you might not want to commit your artifacts to cache
just yet.

Fixes #3974
This commit is contained in:
Ruslan Kuprieiev
2020-06-11 09:50:27 +03:00
committed by GitHub
parent 4042d5232d
commit 87276faef2
8 changed files with 95 additions and 10 deletions
+14
View File
@@ -24,6 +24,20 @@ def test_diff(tmp_dir, scm, dvc):
}
def test_diff_dirty(tmp_dir, scm, dvc):
tmp_dir.gen("params.yaml", "foo: bar")
dvc.run(cmd="echo params.yaml", params=["foo"], single_stage=True)
scm.add(["params.yaml", "Dvcfile"])
scm.commit("bar")
tmp_dir.scm_gen("params.yaml", "foo: baz", commit="baz")
tmp_dir.gen("params.yaml", "foo: qux")
assert dvc.params.diff() == {
"params.yaml": {"foo": {"old": "baz", "new": "qux"}}
}
def test_diff_new(tmp_dir, scm, dvc):
tmp_dir.gen("params.yaml", "foo: bar")
dvc.run(cmd="echo params.yaml", params=["foo"], single_stage=True)