class_docstr: File-based Code Driver handles source control management for the project with files
      
class_docstr_tok: ["File-based","Code","Driver","handles","source","control","management","for","the","project","with","files"]
docstr: Return the commit hash of the repository
docstr_tok: ["Return","the","commit","hash","of","the","repository"]
code: def _calculate_commit_hash(self, tracked_files):
      """Return the commit hash of the repository"""
      # Move tracked files to temp directory within _code_filepath
      # Hash files and return hash
      try:
          temp_dir = tempfile.mkdtemp(dir=self._code_filepath)
          for rel_filepath in tracked_files:
              # Ensure new directory will exist in the temp dir
              filename = os.path.basename(rel_filepath)
              rel_dirpath = rel_filepath.replace(filename, "")
              new_dirpath = os.path.join(temp_dir, rel_dirpath)
              # Ensure directory exists
              if not os.path.isdir(new_dirpath):
                  os.makedirs(new_dirpath)
              # Move individual file from old_filepath to new_filepath
              old_filepath = os.path.join(self.root, rel_filepath)
              new_filepath = os.path.join(new_dirpath, filename)
              shutil.copy2(old_filepath, new_filepath)
          return self._get_dirhash(temp_dir)
      finally:
          try:
              shutil.rmtree(temp_dir)  # delete directory
          except OSError as exc:
              if (
                  exc.errno != errno.ENOENT
              ):  # ENOENT - no such file or directory
                  raise
  
imports: import os
  import shutil
  import errno
  import pathspec
  import tempfile
  import hashlib
  import checksumdir
  from datmo.core.util.misc_functions import list_all_filepaths
  from datmo.core.util.i18n import get
  from datmo.core.util.exceptions import PathDoesNotExist, FileIOError, UnstagedChanges, CodeNotInitialized, CommitDoesNotExist
  from datmo.core.controller.code.driver import CodeDriver
label_desc: Use image node_id 5 for calling the FileCodeDriver obj's underlying member method code with example usage: obj._calculate_commit_hash(tracked_files) and returns: self