mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-08 07:18:27 +01:00
* import: Output as on optional argument Close #1335 * Use tempfile to prevent circular dependencies
This commit is contained in:
committed by
Ruslan Kuprieiev
parent
c6b8be8f8a
commit
38d666d77d
+8
-4
@@ -326,10 +326,11 @@ class RemoteLOCAL(RemoteBase):
|
||||
entry_checksum_info = {self.PARAM_MD5: m}
|
||||
|
||||
if self.changed(entry_info, entry_checksum_info):
|
||||
if force or self._already_cached(p):
|
||||
remove(p)
|
||||
else:
|
||||
self._safe_remove(p)
|
||||
if os.path.exists(p):
|
||||
if force or self._already_cached(p):
|
||||
remove(p)
|
||||
else:
|
||||
self._safe_remove(p)
|
||||
|
||||
self.link(c, p)
|
||||
|
||||
@@ -346,6 +347,9 @@ class RemoteLOCAL(RemoteBase):
|
||||
def _already_cached(self, path):
|
||||
current_md5 = self.state.update(path)
|
||||
|
||||
if not current_md5:
|
||||
return False
|
||||
|
||||
return not self.changed_cache(current_md5)
|
||||
|
||||
def _discard_working_directory_changes(self, path, dir_info, force=False):
|
||||
|
||||
@@ -359,3 +359,16 @@ class TestCheckoutWithDeps(TestRepro):
|
||||
|
||||
self.assertTrue(os.path.exists(self.FOO))
|
||||
self.assertTrue(os.path.exists(self.file1))
|
||||
|
||||
|
||||
class TestCheckoutDirectory(TestRepro):
|
||||
def test(self):
|
||||
stage = self.dvc.add(self.DATA_DIR)[0]
|
||||
|
||||
shutil.rmtree(self.DATA_DIR)
|
||||
self.assertFalse(os.path.exists(self.DATA_DIR))
|
||||
|
||||
ret = main(['checkout', stage.path])
|
||||
self.assertEqual(ret, 0)
|
||||
|
||||
self.assertTrue(os.path.exists(self.DATA_DIR))
|
||||
|
||||
Reference in New Issue
Block a user