mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
dvc: properly remove cached dir
Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
+1
-15
@@ -176,26 +176,12 @@ class Project(object):
|
||||
os.chmod(cache, stat.S_IWRITE)
|
||||
os.unlink(cache)
|
||||
|
||||
def _remove_cache(self, cache):
|
||||
if os.path.isfile(cache):
|
||||
self._remove_cache_file(cache)
|
||||
return
|
||||
|
||||
for root, dirs, files in os.walk(cache, topdown=False):
|
||||
for dname in dirs:
|
||||
path = os.path.join(root, dname)
|
||||
os.rmdir(path)
|
||||
for fname in files:
|
||||
path = os.path.join(root, fname)
|
||||
self._remove_cache_file(path)
|
||||
os.rmdir(cache)
|
||||
|
||||
def gc(self):
|
||||
clist = self._used_cache()
|
||||
for cache in self.cache.all():
|
||||
if cache in clist:
|
||||
continue
|
||||
self._remove_cache(cache)
|
||||
self._remove_cache_file(cache)
|
||||
self.logger.info(u'\'{}\' was removed'.format(self.to_dvc_path(cache)))
|
||||
|
||||
def push(self, target=None, jobs=1):
|
||||
|
||||
Reference in New Issue
Block a user