mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-12 07:18:23 +01:00
Renamed git to repo in dvc/scm/git along with changes in some tests.
This commit is contained in:
@@ -46,7 +46,7 @@ def _clone(cache_dir=None, **kwargs):
|
||||
repo = Repo(_path)
|
||||
cache_config = CacheConfig(repo.config)
|
||||
cache_config.set_dir(cache_dir, level=Config.LEVEL_LOCAL)
|
||||
repo.scm.git.close()
|
||||
repo.scm.close()
|
||||
|
||||
return Repo(_path)
|
||||
|
||||
@@ -70,7 +70,7 @@ def _clone_git_repo(to_path, url=None, rev=None, rev_lock=None):
|
||||
|
||||
|
||||
def _remove(repo):
|
||||
repo.scm.git.close()
|
||||
repo.scm.close()
|
||||
|
||||
if os.name == "nt":
|
||||
# git.exe may hang for a while not permitting to remove temp dir
|
||||
|
||||
@@ -144,3 +144,6 @@ class Base(object):
|
||||
|
||||
def belongs_to_scm(self, path):
|
||||
"""Return boolean whether file belongs to scm"""
|
||||
|
||||
def close(self):
|
||||
""" Method to close the files """
|
||||
|
||||
@@ -323,3 +323,6 @@ class Git(Base):
|
||||
|
||||
def get_rev(self):
|
||||
return self.repo.git.rev_parse("HEAD")
|
||||
|
||||
def close(self):
|
||||
self.repo.close()
|
||||
|
||||
+1
-1
@@ -166,7 +166,7 @@ class TestDvcGitFixture(TestGitFixture):
|
||||
self.dvc.scm.commit("init dvc")
|
||||
|
||||
def tearDown(self):
|
||||
self.dvc.scm.git.close()
|
||||
self.dvc.scm.close()
|
||||
super(TestDvcGitFixture, self).tearDown()
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -162,7 +162,7 @@ def erepo(repo_dir):
|
||||
|
||||
repo.dvc.scm.checkout("master")
|
||||
|
||||
repo.dvc.scm.git.close()
|
||||
repo.dvc.scm.close()
|
||||
repo.git.close()
|
||||
|
||||
os.chdir(repo._saved_dir)
|
||||
|
||||
@@ -96,7 +96,7 @@ class TestDiffDir(TestDvcGit):
|
||||
self.git.index.add([self.DATA_DIR + ".dvc"])
|
||||
self.git.index.commit("adds data_dir")
|
||||
self.a_ref = self.git.git.rev_parse(
|
||||
self.dvc.scm.git.head.commit, short=True
|
||||
self.dvc.scm.repo.head.commit, short=True
|
||||
)
|
||||
self.old_checksum = _get_checksum(self.dvc, self.DATA_DIR)
|
||||
self.new_file = os.path.join(self.DATA_SUB_DIR, diff.DIFF_NEW_FILE)
|
||||
@@ -154,7 +154,7 @@ class TestDiffDirRepoDeletedFile(TestDiffDir):
|
||||
|
||||
self.b_ref = self.a_ref
|
||||
self.new_checksum = self.old_checksum
|
||||
self.a_ref = str(self.dvc.scm.git.head.commit)
|
||||
self.a_ref = str(self.dvc.scm.repo.head.commit)
|
||||
self.old_checksum = _get_checksum(self.dvc, self.DATA_DIR)
|
||||
|
||||
def test(self):
|
||||
|
||||
@@ -88,12 +88,12 @@ class TestInstall(object):
|
||||
assert ret == 0
|
||||
|
||||
stage_file = repo_dir.FOO + Stage.STAGE_FILE_SUFFIX
|
||||
dvc_repo.scm.git.index.add([stage_file, ".gitignore"])
|
||||
dvc_repo.scm.git.index.commit("commit message")
|
||||
dvc_repo.scm.repo.index.add([stage_file, ".gitignore"])
|
||||
dvc_repo.scm.repo.index.commit("commit message")
|
||||
|
||||
dvc_repo.scm.git.clone(git_remote)
|
||||
dvc_repo.scm.git.create_remote("origin", git_remote)
|
||||
dvc_repo.scm.repo.clone(git_remote)
|
||||
dvc_repo.scm.repo.create_remote("origin", git_remote)
|
||||
|
||||
dvc_repo.scm.git.git.push("origin", "master")
|
||||
dvc_repo.scm.repo.git.push("origin", "master")
|
||||
|
||||
assert os.path.isfile(expected_cache_path)
|
||||
|
||||
@@ -22,7 +22,7 @@ class TestMetricsBase(TestDvcGit):
|
||||
branches = ["foo", "bar", "baz"]
|
||||
|
||||
for branch in branches:
|
||||
self.dvc.scm.git.create_head(branch)
|
||||
self.dvc.scm.repo.create_head(branch)
|
||||
|
||||
for branch in branches:
|
||||
self.dvc.scm.checkout(branch)
|
||||
@@ -692,7 +692,7 @@ class TestCachedMetrics(TestDvcGit):
|
||||
|
||||
# TestDvc currently is based on TestGit, so it is safe to use
|
||||
# scm.git for now
|
||||
self.dvc.scm.git.git.clean("-fd")
|
||||
self.dvc.scm.repo.git.clean("-fd")
|
||||
|
||||
self.dvc = DvcRepo(".")
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class TestCollect(TestDvcGit):
|
||||
|
||||
def _check(self, branch, target, with_deps, expected):
|
||||
if branch:
|
||||
self.dvc.tree = GitTree(self.dvc.scm.git, branch)
|
||||
self.dvc.tree = GitTree(self.dvc.scm.repo, branch)
|
||||
else:
|
||||
self.dvc.tree = WorkingTree()
|
||||
result = self.dvc.collect(target + ".dvc", with_deps=with_deps)
|
||||
|
||||
@@ -42,7 +42,7 @@ class TestSCMGit(TestGit):
|
||||
G.commit("add")
|
||||
self.assertTrue(G.is_tracked(foo))
|
||||
self.assertTrue(G.is_tracked(self.FOO))
|
||||
G.git.index.remove([self.FOO], working_tree=True)
|
||||
G.repo.index.remove([self.FOO], working_tree=True)
|
||||
self.assertFalse(G.is_tracked(foo))
|
||||
self.assertFalse(G.is_tracked(self.FOO))
|
||||
self.assertFalse(G.is_tracked("not-existing-file"))
|
||||
|
||||
@@ -30,7 +30,7 @@ def test_update_import(dvc_repo, erepo):
|
||||
repo.scm.commit("updated")
|
||||
repo.scm.checkout("master")
|
||||
|
||||
repo.scm.git.close()
|
||||
repo.scm.close()
|
||||
|
||||
os.chdir(saved_dir)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user