Merge pull request #281 from efiop/master

Read-only data files, small fixes
This commit is contained in:
Ruslan Kuprieiev
2017-11-01 05:05:56 +02:00
committed by GitHub
3 changed files with 10 additions and 6 deletions
+4 -3
View File
@@ -1,4 +1,5 @@
import os
import stat
import shutil
from dvc.path.path import Path
@@ -104,6 +105,6 @@ class DataItem(object):
md5 = file_md5(self.data.relative)[0]
self._cache_file = os.path.join(self.cache_dir, md5)
self._git.modify_gitignore([self.data.relative])
if os.path.isfile(self.cache.relative):
return
System.hardlink(self.data.relative, self.cache.relative)
if not os.path.isfile(self.cache.relative):
System.hardlink(self.data.relative, self.cache.relative)
os.chmod(self.data.relative, stat.S_IREAD)
+1 -1
View File
@@ -4,7 +4,7 @@ from dvc.path.data_item import DataItem, DataItemError, DataDirError
from dvc.path.path import Path
from dvc.path.stated_data_item import StatedDataItem
from dvc.system import System
from dvc.logger import Logger
class PathFactory(object):
def __init__(self, git, config):
+5 -2
View File
@@ -7,7 +7,7 @@ from dvc.logger import Logger
from dvc.path.data_item import DataDirError, DataItemInStatusDirError
from dvc.path.stated_data_item import StatedDataItem
from dvc.utils import cached_property
from dvc.config import ConfigI
class RepositoryChangeError(DvcException):
def __init__(self, msg):
@@ -116,7 +116,10 @@ class RepositoryChange(object):
def data_file_timesteps(self):
res = set()
for root, dirs, files in os.walk('.'):
for root, dirs, files in os.walk(self._settings.git.git_dir_abs):
if root.startswith(os.path.join(self._settings.git.git_dir_abs, ConfigI.CONFIG_DIR)):
continue
for file in files:
filename = os.path.join(root, file)
if os.path.exists(filename):