code: def repo_model_to_repo_head(
      repo_model: RepoModel,
      include_creds: bool = False,
  ) -> AnyRepoHead:
      if include_creds:
          return RepoHeadWithCreds.parse_obj(
              {
                  "repo_id": repo_model.name,
                  "repo_info": json.loads(repo_model.info),
                  "repo_creds": json.loads(repo_model.creds)
                  if repo_model.creds
                  else None,
              }
          )
      return RepoHead.parse_obj(
          {
              "repo_id": repo_model.name,
              "repo_info": json.loads(repo_model.info),
          }
      )
  
file_path: dstack/src/dstack/_internal/server/services/repos.py
imports: import json
  from typing import List, Optional
  import sqlalchemy.exc
  from fastapi import UploadFile
  from sqlalchemy import delete, insert, select, update
  from sqlalchemy.ext.asyncio import AsyncSession
  from dstack._internal.core.errors import RepoDoesNotExistError, ServerClientError
  from dstack._internal.core.models.repos import AnyRepoHead, AnyRepoInfo, RepoHead, RepoHeadWithCreds
  from dstack._internal.core.models.repos.remote import RemoteRepoCreds
  from dstack._internal.server.models import CodeModel, ProjectModel, RepoModel
  from dstack._internal.server.services.storage import get_default_storage
  from dstack._internal.server.utils.common import run_async
label_desc: Use image node_id 1 for calling a global function with example usage: repo_model_to_repo_head(repo_model, include_creds) and returns: RepoHead, RepoHeadWithCreds