mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-12 15:28:21 +01:00
dvc: remove data dir
From now on, we're no longer tied to fixed data dir, so we can track individual data items without forcing user to use separate dir for them. This way we add much more flexibility for dvc, so users can use their own project structure. Fixes #68 Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
+3
-10
@@ -16,8 +16,6 @@ class InitError(DvcException):
|
||||
|
||||
class CmdInit(CmdBase):
|
||||
CONFIG_TEMPLATE = '''[Global]
|
||||
DataDir = {}
|
||||
|
||||
# Default target
|
||||
Target =
|
||||
|
||||
@@ -92,28 +90,23 @@ ProjectName =
|
||||
return 1
|
||||
|
||||
config_dir_path = self.get_not_existing_path(Config.CONFIG_DIR)
|
||||
data_dir_path = self.get_not_existing_path(self.parsed_args.data_dir)
|
||||
cache_dir_path = self.get_not_existing_path(Config.CONFIG_DIR, Config.CACHE_DIR)
|
||||
state_dir_path = self.get_not_existing_path(Config.CONFIG_DIR, Config.STATE_DIR)
|
||||
|
||||
self.settings.config.set(self.parsed_args.data_dir)
|
||||
|
||||
conf_file_name = self.get_not_existing_conf_file_name()
|
||||
|
||||
config_dir_path.mkdir()
|
||||
data_dir_path.mkdir()
|
||||
cache_dir_path.mkdir()
|
||||
state_dir_path.mkdir()
|
||||
Logger.info('Directories {}/, {}/, {}/, {}/ were created'.format(
|
||||
Logger.info('Directories {}/, {}/, {}/ were created'.format(
|
||||
config_dir_path.name,
|
||||
data_dir_path.name,
|
||||
os.path.join(config_dir_path.name, cache_dir_path.name),
|
||||
os.path.join(config_dir_path.name, state_dir_path.name)))
|
||||
|
||||
self.create_empty_file()
|
||||
|
||||
conf_file = open(conf_file_name, 'wt')
|
||||
conf_file.write(self.CONFIG_TEMPLATE.format(data_dir_path.name))
|
||||
conf_file.write(self.CONFIG_TEMPLATE)
|
||||
conf_file.close()
|
||||
|
||||
self.git.modify_gitignore([os.path.join(config_dir_path.name, cache_dir_path.name),
|
||||
@@ -123,7 +116,7 @@ ProjectName =
|
||||
return self.commit_if_needed(message)
|
||||
|
||||
def create_empty_file(self):
|
||||
empty_data_path = os.path.join(self.parsed_args.data_dir, self.EMPTY_FILE_NAME)
|
||||
empty_data_path = os.path.join(self.settings.git.git_dir_abs, self.EMPTY_FILE_NAME)
|
||||
|
||||
data_item = self.settings.path_factory.data_item(empty_data_path)
|
||||
open(empty_data_path, 'w').close()
|
||||
|
||||
Reference in New Issue
Block a user