run: create 'Dvcfile' by default

Fixes #344

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2017-12-10 05:41:17 +02:00
parent 554b928d62
commit 300332e223
3 changed files with 6 additions and 16 deletions
+2 -1
View File
@@ -19,6 +19,7 @@ from dvc.command.config import CmdConfig
from dvc.command.show_pipeline import CmdShowPipeline
from dvc.command.merge import CmdMerge
from dvc.command.checkout import CmdCheckout
from dvc.state_file import StateFile
from dvc import VERSION
@@ -115,7 +116,7 @@ def parse_args(argv=None):
help='Lock data item - disable reproduction.')
run_parser.add_argument('-f',
'--file',
default='stage.dvc',
default=StateFile.DVCFILE_NAME,
help='Specify name of the state file')
run_parser.add_argument(
'command',
-13
View File
@@ -419,19 +419,6 @@ class GitWrapper(GitWrapperI):
return ''
return out
@staticmethod
def state_files_for_previous_commit():
commit = GitWrapper.git_prev_commit()
Logger.debug(u'[dvc-git] Previous commit "{}"'.format(commit))
if not commit:
Logger.debug(u'[dvc-git] Previous commit does not exist')
return []
git_cmd = u'git ls-tree --name-only -r {}'.format(commit)
lines = Executor.exec_cmd_only_success(git_cmd.split()).split('\n')
return list(filter(lambda s: s.endswith(DataItem.STATE_FILE_SUFFIX), lines))
@staticmethod
def branches(regexp):
cmd = 'git branch --format "%(refname)"'
+4 -2
View File
@@ -25,6 +25,7 @@ class StateFileBase(object):
class StateFile(StateFileBase):
DVCFILE_NAME = 'Dvcfile'
STATE_FILE_SUFFIX = '.dvc'
PARAM_CMD = 'cmd'
@@ -84,7 +85,9 @@ class StateFile(StateFileBase):
@staticmethod
def _is_state_file(path):
return path.endswith(StateFile.STATE_FILE_SUFFIX) and os.path.isfile(path)
return (path.endswith(StateFile.STATE_FILE_SUFFIX) or \
os.path.basename(path) == StateFile.DVCFILE_NAME) and \
os.path.isfile(path)
@staticmethod
def _find_state(fname, dname):
@@ -92,7 +95,6 @@ class StateFile(StateFileBase):
for entry in os.listdir(dname):
state_file = os.path.join(dname, entry)
if not StateFile._is_state_file(state_file):
# if not state_file.endswith(StateFile.STATE_FILE_SUFFIX) or not os.path.isfile(state_file):
continue
state = StateFile.load(os.path.join(dname, state_file))
if name in state.out: