code: def test_diff_targeted(tmp_dir, scm, dvc, run_copy):
      from dvc.dvcfile import PROJECT_FILE
  
      tmp_dir.gen(
          {
              "foo": "foo",
              "params.yaml": "foo: bar",
              "other_params.yaml": "xyz: val",
          }
      )
      run_copy(
          "foo",
          "bar",
          name="copy-foo-bar",
          params=["foo", "other_params.yaml:xyz"],
      )
  
      scm.add(["params.yaml", "other_params.yaml", PROJECT_FILE])
      scm.commit("add stage")
  
      tmp_dir.scm_gen(
          {"params.yaml": "foo: baz", "other_params.yaml": "xyz: val2"},
          commit="baz",
      )
      tmp_dir.scm_gen(
          {"params.yaml": "foo: qux", "other_params.yaml": "xyz: val3"},
          commit="qux",
      )
  
      assert dvc.params.diff(a_rev="HEAD~2") == {
          "diff": {
              "params.yaml": {"foo": {"old": "bar", "new": "qux"}},
              "other_params.yaml": {
                  "xyz": {"old": "val", "new": "val3"}
              },
          }
      }
  
      assert dvc.params.diff(
          a_rev="HEAD~2", targets=["params.yaml"]
      ) == {
          "diff": {"params.yaml": {"foo": {"old": "bar", "new": "qux"}}}
      }
  
      assert dvc.params.diff(
          a_rev="HEAD~2", targets=["other_params.yaml"]
      ) == {
          "diff": {
              "other_params.yaml": {
                  "xyz": {"old": "val", "new": "val3"}
              }
          }
      }
  
file_path: dvc/tests/func/params/test_diff.py
imports: from os.path import join
  import pytest
  from dvc.utils import relpath
label_desc: Use image node_id 13 for calling a global function with example usage: test_diff_targeted(tmp_dir, scm, dvc, run_copy) without return types