dvc/repo/experiments/__init__.py
def checkout_exp(self, rev, force=False):
        """Checkout an experiment to the user's workspace."""
        from git.exc import GitCommandError
        from dvc.repo.checkout import _checkout as dvc_checkout

        if force:
            self.repo.scm.repo.git.reset(hard=True)
        self._scm_checkout(rev)

        tmp = tempfile.NamedTemporaryFile(delete=False).name
        self.scm.repo.head.commit.diff("HEAD~1", patch=True, output=tmp)
        try:
            if os.path.getsize(tmp):
                logger.debug("Patching local workspace")
                self.repo.scm.repo.git.apply(tmp, reverse=True)
            dvc_checkout(self.repo)
        except GitCommandError:
            raise DvcException(
                "Checkout failed, experiment contains changes which "
                "conflict with your current workspace. To overwrite "
                "your workspace, use `dvc experiments checkout --force`."
            )
        finally:
            remove(tmp)
Checkout an experiment to the user's workspace.
Checkout an experiment to the user's workspace.
Checkout an experiment to the user ' s workspace .
def checkout_exp(self, rev, force=False):
        from git.exc import GitCommandError
        from dvc.repo.checkout import _checkout as dvc_checkout
        if force:
            self.repo.scm.repo.git.reset(hard=True)
        self._scm_checkout(rev)
        tmp = tempfile.NamedTemporaryFile(delete=False).name
        self.scm.repo.head.commit.diff("HEAD~1", patch=True, output=tmp)
        try:
            if os.path.getsize(tmp):
                logger.debug("Patching local workspace")
                self.repo.scm.repo.git.apply(tmp, reverse=True)
            dvc_checkout(self.repo)
        except GitCommandError:
            raise DvcException(
                "Checkout failed, experiment contains changes which "
                "conflict with your current workspace. To overwrite "
                "your workspace, use `dvc experiments checkout --force`."
            )
        finally:
            remove(tmp)
def checkout_exp ( self , rev , force = False ) : from git . exc import GitCommandError from dvc . repo . checkout import _checkout as dvc_checkout if force : self . repo . scm . repo . git . reset ( hard = True ) self . _scm_checkout ( rev ) tmp = tempfile . NamedTemporaryFile ( delete = False ) . name self . scm . repo . head . commit . diff ( "HEAD~1" , patch = True , output = tmp ) try : if os . path . getsize ( tmp ) : logger . debug ( "Patching local workspace" ) self . repo . scm . repo . git . apply ( tmp , reverse = True ) dvc_checkout ( self . repo ) except GitCommandError : raise DvcException ( "Checkout failed, experiment contains changes which " "conflict with your current workspace. To overwrite " "your workspace, use `dvc experiments checkout --force`." ) finally : remove ( tmp )
Checkout an experiment to the user's workspace.
Checkout an experiment to the user ' s workspace .
"""Checkout an experiment to the user's workspace."""
self
rev
force