mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
Merge pull request #386 from efiop/master
dvc: cleanup artifacts from #382
This commit is contained in:
+1
-1
@@ -30,7 +30,7 @@ class Cache(object):
|
||||
file_set = set(files)
|
||||
cached = {}
|
||||
for cache_file in self.all():
|
||||
cached_files = list(filter(lambda f: System.samefile(cache_file, f, True), file_set))
|
||||
cached_files = list(filter(lambda f: System.samefile(cache_file, f), file_set))
|
||||
cached.update(dict((f, os.path.basename(cache_file)) for f in cached_files))
|
||||
file_set = file_set - set(cached_files)
|
||||
return cached
|
||||
|
||||
@@ -233,13 +233,6 @@ class Project(object):
|
||||
|
||||
return G
|
||||
|
||||
def all_directions(self):
|
||||
result = []
|
||||
for stage in self.stages():
|
||||
for dep in stage.deps + stage.outs:
|
||||
result.append((stage, dep))
|
||||
return result
|
||||
|
||||
def stages(self):
|
||||
stages = []
|
||||
for root, dirs, files in os.walk(self.root_dir):
|
||||
|
||||
@@ -58,10 +58,6 @@ class Output(object):
|
||||
def dvc_path(self):
|
||||
return os.path.relpath(self.path, self.project.root_dir)
|
||||
|
||||
@property
|
||||
def dvc_path(self):
|
||||
return os.path.relpath(self.path, self.project.root_dir)
|
||||
|
||||
def _changed_md5(self):
|
||||
if not os.path.exists(self.path):
|
||||
return True
|
||||
|
||||
@@ -54,7 +54,6 @@ class State(object):
|
||||
return State(root_dir, dvc_dir)
|
||||
|
||||
def update(self, path, md5, mtime):
|
||||
mtime = int(mtime)
|
||||
existing = self.get(path)
|
||||
if not existing:
|
||||
return self.add(path, md5, mtime)
|
||||
@@ -65,7 +64,6 @@ class State(object):
|
||||
return state
|
||||
|
||||
def add(self, path, md5, mtime):
|
||||
mtime = int(mtime)
|
||||
entry = StateEntry(self.root_dir, path, md5, mtime)
|
||||
self._db.insert(entry.dumpd())
|
||||
return entry
|
||||
|
||||
+3
-4
@@ -26,10 +26,9 @@ class System(object):
|
||||
return winlink.create(source, link_name)
|
||||
|
||||
@staticmethod
|
||||
def samefile(path1, path2, check_exist=False):
|
||||
if check_exist:
|
||||
if not os.path.exists(path1) or not os.path.exists(path2):
|
||||
return False
|
||||
def samefile(path1, path2):
|
||||
if not os.path.exists(path1) or not os.path.exists(path2):
|
||||
return False
|
||||
|
||||
if System.is_unix():
|
||||
return os.path.samefile(path1, path2)
|
||||
|
||||
Reference in New Issue
Block a user