code: def test_update_rev(tmp_dir, dvc, scm, git_dir):
      with git_dir.chdir():
          git_dir.scm_gen({"foo": "foo"}, commit="first")
  
      dvc.imp(os.fspath(git_dir), "foo")
      assert (tmp_dir / "foo.dvc").exists()
  
      with git_dir.chdir(), git_dir.branch("branch1", new=True):
          git_dir.scm_gen({"foo": "foobar"}, commit="branch1 commit")
          branch1_head = git_dir.scm.get_rev()
  
      with git_dir.chdir(), git_dir.branch("branch2", new=True):
          git_dir.scm_gen(
              {"foo": "foobar foo"}, commit="branch2 commit"
          )
          branch2_head = git_dir.scm.get_rev()
  
      stage = dvc.update(["foo.dvc"], rev="branch1")[0]
      assert stage.deps[0].def_repo == {
          "url": os.fspath(git_dir),
          "rev": "branch1",
          "rev_lock": branch1_head,
      }
      with open(tmp_dir / "foo", encoding="utf-8") as f:
          assert f.read() == "foobar"
  
      stage = dvc.update(["foo.dvc"], rev="branch2")[0]
      assert stage.deps[0].def_repo == {
          "url": os.fspath(git_dir),
          "rev": "branch2",
          "rev_lock": branch2_head,
      }
      with open(tmp_dir / "foo", encoding="utf-8") as f:
          assert f.read() == "foobar foo"
  
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 9 for calling a global function with example usage: test_update_rev(tmp_dir, dvc, scm, git_dir) without return types