Esempio n. 1
0
    def __init__(self, args):
        from dvc.project import Project, NotDvcProjectError

        self.args = args

        try:
            dvc_dir = os.path.join(Project.find_root(), Project.DVC_DIR)
            saved_exc = None
        except NotDvcProjectError as exc:
            dvc_dir = None
            saved_exc = exc

        self.config = Config(dvc_dir, validate=False)
        if self.args.system:
            self.configobj = self.config._system_config
        elif self.args.glob:
            self.configobj = self.config._global_config
        elif self.args.local:
            if dvc_dir is None:
                raise saved_exc
            self.configobj = self.config._local_config
        else:
            if dvc_dir is None:
                raise saved_exc
            self.configobj = self.config._project_config
Esempio n. 2
0
    def run(self):
        import os
        from dvc.project import Project
        from dvc.updater import Updater

        root_dir = Project.find_root()
        dvc_dir = os.path.join(root_dir, Project.DVC_DIR)
        updater = Updater(dvc_dir)
        updater.fetch(detach=False)

        return 0
Esempio n. 3
0
    def collect(self):
        """Collect analytics report."""
        from dvc.scm import SCM
        from dvc.utils import is_binary
        from dvc.project import Project
        from dvc.exceptions import NotDvcProjectError

        self.info[self.PARAM_DVC_VERSION] = VERSION
        self.info[self.PARAM_IS_BINARY] = is_binary()
        self.info[self.PARAM_USER_ID] = self._get_user_id()

        self.info[self.PARAM_SYSTEM_INFO] = self._collect_system_info()

        try:
            scm = SCM(root_dir=Project.find_root())
            self.info[self.PARAM_SCM_CLASS] = type(scm).__name__
        except NotDvcProjectError:
            pass