Ejemplo n.º 1
0
def test_collect(tmp_dir, scm, dvc, run_copy):
    def collect_outs(*args, **kwargs):
        return set(
            str(out.path_info)
            for stage in dvc.collect(*args, **kwargs)
            for out in stage.outs
        )

    tmp_dir.dvc_gen("foo", "foo")
    run_copy("foo", "bar")
    scm.add([".gitignore", "foo.dvc", "bar.dvc"])
    scm.commit("Add foo and bar")

    scm.checkout("new-branch", create_new=True)

    run_copy("bar", "buzz")
    scm.add([".gitignore", "buzz.dvc"])
    scm.commit("Add buzz")

    assert collect_outs("bar.dvc", with_deps=True) == {"foo", "bar"}

    dvc.tree = GitTree(scm.repo, "new-branch")

    assert collect_outs("buzz.dvc", with_deps=True) == {"foo", "bar", "buzz"}
    assert collect_outs("buzz.dvc", with_deps=False) == {"buzz"}
Ejemplo n.º 2
0
 def get_tree(self, rev):
     return GitTree(self.repo, self.resolve_rev(rev))
Ejemplo n.º 3
0
 def get_tree(self, rev):
     return GitTree(self.repo, rev)
Ejemplo n.º 4
0
 def get_tree(self, rev):
     return GitTree(self.git, rev)
Ejemplo n.º 5
0
 def get_tree(self, rev, **kwargs):
     return GitTree(self.repo, self.resolve_rev(rev), **kwargs)