code: def test_update_import(tmp_dir, dvc, erepo_dir, cached):
      gen = erepo_dir.dvc_gen if cached else erepo_dir.scm_gen
  
      with erepo_dir.branch("branch", new=True), erepo_dir.chdir():
          gen(
              {
                  "version": "branch",
                  "dir": {
                      "version": "branch",
                      "subdir": {"file": "file"},
                  },
              },
              commit="add version file",
          )
          old_rev = erepo_dir.scm.get_rev()
  
      stage = dvc.imp(
          os.fspath(erepo_dir), "version", "version", rev="branch"
      )
      dir_stage = dvc.imp(
          os.fspath(erepo_dir), "dir", "dir", rev="branch"
      )
      assert dvc.status() == {}
  
      assert (tmp_dir / "version").read_text() == "branch"
      assert (tmp_dir / "dir").read_text() == {
          "version": "branch",
          "subdir": {"file": "file"},
      }
      assert stage.deps[0].def_repo["rev_lock"] == old_rev
      assert dir_stage.deps[0].def_repo["rev_lock"] == old_rev
  
      # Update version file
      with erepo_dir.branch("branch", new=False), erepo_dir.chdir():
          gen(
              {
                  "version": "updated",
                  "dir": {
                      "version": "updated",
                      "subdir": {"file": "file"},
                  },
              },
              commit="update version content",
          )
          new_rev = erepo_dir.scm.get_rev()
  
      assert old_rev != new_rev
  
      assert dvc.status() == {
          "dir.dvc": [
              {
                  "changed deps": {
                      f"dir ({os.fspath(erepo_dir)})": "update available"
                  }
              }
          ],
          "version.dvc": [
              {
                  "changed deps": {
                      f"version ({os.fspath(erepo_dir)})": "update available"
                  }
              }
          ],
      }
  
      (stage,) = dvc.update(stage.path)
      (dir_stage,) = dvc.update(dir_stage.path)
      assert dvc.status() == {}
  
      assert (tmp_dir / "version").read_text() == "updated"
      assert (tmp_dir / "dir").read_text() == {
          "version": "updated",
          "subdir": {"file": "file"},
      }
  
      assert stage.deps[0].def_repo["rev_lock"] == new_rev
      assert dir_stage.deps[0].def_repo["rev_lock"] == new_rev
  
imports: import os
  import pytest
  from dvc.dependency import base
  from dvc.dvcfile import load_file
  from dvc.exceptions import InvalidArgumentError
  from dvc.testing.tmp_dir import make_subrepo
label_desc: Use image node_id 1 for calling a global function with example usage: test_update_import(tmp_dir, dvc, erepo_dir, cached) without return types