code: def commit_2_to_3(repo: "Repo", dry: bool = False):
      """Force-commit all legacy outputs to use DVC 3.0 hashes."""
      from dvc.dvcfile import ProjectFile
      from dvc.ui import ui
  
      view = repo.index.targets_view(
          targets=None,
          outs_filter=lambda o: o.hash_name == "md5-dos2unix",
          recursive=True,
      )
      migrated = _migrateable_dvcfiles(view)
      if not migrated:
          ui.write(
              "No DVC files in the repo to migrate to the 3.0 format."
          )
          return
      if dry:
          ui.write(
              "Entries in following DVC files will be migrated to the 3.0 format:"
          )
          ui.write("\n".join(sorted(f"\t{file}" for file in migrated)))
          return
      for stage, filter_info in view._stage_infos:
          outs_filter = view._outs_filter
          outs = {
              out
              for out in stage.filter_outs(filter_info)
              if outs_filter is not None and outs_filter(out)
          }
          modified = False
          if outs:
              for out in outs:
                  out.update_legacy_hash_name(force=True)
              modified = True
          deps = {
              dep
              for dep in stage.deps
              if not stage.is_import and dep.is_in_repo
          }
          if deps:
              for dep in deps:
                  dep.update_legacy_hash_name(force=True)
              modified = True
          if modified:
              stage.save(allow_missing=True)
              stage.commit(allow_missing=True, relink=True)
              if not isinstance(stage.dvcfile, ProjectFile):
                  ui.write(
                      f"Updating DVC file '{stage.dvcfile.relpath}'"
                  )
              stage.dump(update_pipeline=False)
  
file_path: dvc/dvc/repo/commit.py
imports: from typing import TYPE_CHECKING, Set
  from dvc import prompt
  from .None import locked
  from .scm_context import scm_context
label_desc: Use image node_id 4 for calling a global function with example usage: commit_2_to_3(repo, dry) without return types