def get_dvc_path(self): pwd = System.get_cwd() if not pwd.startswith(self.settings.git.git_dir_abs): raise StateFileError( 'the file cannot be created outside of a git repository') return os.path.relpath(pwd, self.settings.git.git_dir_abs)
def __init__(self, path, git): if not os.path.isabs(path): pwd = System.get_cwd() path = os.path.normpath(os.path.join(pwd, path)) self._abs = path self._dvc = os.path.relpath(self.abs, git.git_dir_abs) self._relative = os.path.relpath(self._abs, git.curr_dir_abs) self._filename = os.path.basename(self._abs)