mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-26 15:28:28 +01:00
Bug fixing
This commit is contained in:
@@ -39,7 +39,7 @@ class CmdCheckout(CmdBase):
|
||||
states = self.git.state_files_for_previous_commit()
|
||||
prev_items = self.settings.path_factory.data_items_from_states(states, existing=False)
|
||||
except Exception as ex:
|
||||
Logger.error(u'Unable to get data files from previous commit'.format(ex))
|
||||
Logger.error(u'Unable to get data files from previous commit: {}'.format(ex))
|
||||
return 1
|
||||
|
||||
curr_items = self.settings.path_factory.all_existing_data_items()
|
||||
@@ -53,7 +53,8 @@ class CmdCheckout(CmdBase):
|
||||
for item in removed_items_set:
|
||||
path = item.data.relative
|
||||
if not os.path.exists(path):
|
||||
print(u'Remove \'{}\' - file does not exist'.format(path))
|
||||
print(u'Remove \'{}\'.'.format(path))
|
||||
Logger.warn(u'File \'{}\' does not exist'.format(path))
|
||||
else:
|
||||
Logger.info(u'Remove \'{}\''.format(path))
|
||||
os.remove(path)
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@ from collections import defaultdict
|
||||
|
||||
from dvc.exceptions import DvcException
|
||||
from dvc.logger import Logger
|
||||
from dvc.config import Config
|
||||
from dvc.config import Config, ConfigI
|
||||
from dvc.executor import Executor, ExecutorError
|
||||
from dvc.path.data_item import DataItemError
|
||||
from dvc.state_file import StateFile
|
||||
@@ -432,8 +432,8 @@ class GitWrapper(GitWrapperI):
|
||||
@staticmethod
|
||||
def state_files_for_previous_commit():
|
||||
commit = GitWrapper.git_prev_commit()
|
||||
Logger.debug(u'[dvc-git] Previous commit {}'.format(commit))
|
||||
Logger.debug(u'[dvc-git] Previous commit "{}"'.format(commit))
|
||||
|
||||
git_cmd = u'git ls-tree --name-only -r {}'.format(commit)
|
||||
lines = Executor.exec_cmd_only_success(git_cmd.split()).split('\n')
|
||||
return filter(lambda s: s.startswith('.dvc/state'), map(unicode.split, lines))
|
||||
return filter(lambda s: s.startswith(ConfigI.STATE_DIR), lines)
|
||||
|
||||
+1
-1
@@ -73,5 +73,5 @@ class PathFactory(object):
|
||||
states)
|
||||
|
||||
@staticmethod
|
||||
def state_path_to_dvc_path(self, state):
|
||||
def state_path_to_dvc_path(state):
|
||||
return os.path.relpath(state, ConfigI.STATE_DIR)[:-len(DataItem.STATE_FILE_SUFFIX)]
|
||||
|
||||
Reference in New Issue
Block a user