code: def revert_workspace(self):
      apply_head = self.scm.get_ref(self.ref)
      head = self.scm.get_rev()
      if apply_head != head:
          raise DvcException(
              f"Cannot revert workspace, current HEAD '{head[:7]}' does not match the"
              f" pre-apply HEAD '{apply_head[:7]}'"
          )
      self.scm.reset(hard=True)
      if len(self):
          # In the event that the apply-stash and current workspace contain
          # conflicting untracked files, we do:
          #   1. stash the current untracked files
          #   2. restore/pop the apply-stash (with untracked files)
          #   3. restore/pop the untracked files from (1) and ignore any conflicts
          #      (forcefully reverting to the apply-stash version)
          workspace_rev = self.scm.stash.push(include_untracked=True)
          try:
              self.pop()
          finally:
              if workspace_rev:
                  self.scm.stash.pop(skip_conflicts=True)
      self.scm.remove_ref(self.ref)
  
imports: import re
  from contextlib import contextmanager
  from typing import Dict, Iterable, Iterator, NamedTuple, Optional
  from scmrepo.git import Stash
  from dvc.exceptions import DvcException
  from dvc.log import logger
  from dvc_objects.fs.local import localfs
  from dvc_objects.fs.utils import as_atomic
  from .refs import APPLY_HEAD, APPLY_STASH
label_desc: Use image node_id 6 for calling the ApplyStash obj's underlying member method code with example usage: obj.revert_workspace() without return types