MCPcopy Index your code
hub / github.com/treeverse/dvc / init

Method init

dvc/testing/tmp_dir.py:87–105  ·  view source on GitHub ↗
(self, *, scm=False, dvc=False, subdir=False)

Source from the content-addressed store, hash-verified

85 return self
86
87 def init(self, *, scm=False, dvc=False, subdir=False):
88 from dvc.repo import Repo
89 from dvc.scm import Git
90
91 assert not scm or not hasattr(self, "scm")
92 assert not dvc or not hasattr(self, "dvc")
93
94 if scm:
95 Git.init(self.fs_path).close()
96 if dvc:
97 self.dvc = Repo.init(
98 self.fs_path,
99 no_scm=not scm and not hasattr(self, "scm"),
100 subdir=subdir,
101 )
102 if scm:
103 self.scm = self.dvc.scm if hasattr(self, "dvc") else Git(self.fs_path)
104 if dvc and hasattr(self, "scm"):
105 self.scm.commit("init dvc")
106
107 def close(self):
108 if hasattr(self, "scm"):

Callers 2

make_subrepoFunction · 0.45
makeFunction · 0.45

Calls 2

closeMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected