code: def test_new_or_modified(path=None):
      def get_new_or_modified(*args, **kwargs):
          return [
              op.relpath(ap["path"], path)
              for ap in new_or_modified(diff_revision(*args, **kwargs))
          ]
  
      ds = Dataset(path).create(force=True, annex=False)
  
      # Check out an orphan branch so that we can test the "one commit
      # in a repo" case.
      ds.repo.checkout("orph", options=["--orphan"])
      ds.save()
      assert_false(ds.repo.dirty)
      eq_(len(ds.repo.get_revisions("HEAD")), 1)
      # Diffing doesn't fail when the branch contains a single commit.
      assert_in("to_modify", get_new_or_modified(ds, "HEAD"))
  
      # New files are detected, deletions are not.
      ds.repo.remove(["to_remove"])
      ok_(ds.repo.dirty)
  
      with open(op.join(path, "to_add"), "w") as f:
          f.write("content5")
      ds.repo.add(["to_add"])
      ds.repo.commit("add one, remove another")
  
      eq_(get_new_or_modified(ds, "HEAD"), ["to_add"])
  
      # Modifications are detected.
      with open(op.join(path, "to_modify"), "w") as f:
          f.write("updated 1")
      with open(op.join(path, "d/to_modify"), "w") as f:
          f.write("updated 2")
      ds.save(["to_modify", "d/to_modify"])
  
      eq_(
          set(get_new_or_modified(ds, "HEAD")),
          {"to_modify", op.join("d", "to_modify")},
      )
  
      # Non-HEAD revisions work.
      ds.repo.commit("empty", options=["--allow-empty"])
      assert_false(get_new_or_modified(ds, "HEAD"))
      eq_(
          set(get_new_or_modified(ds, "HEAD~")),
          {"to_modify", op.join("d", "to_modify")},
      )
  
imports: import logging
  import os.path
  import sys
  from io import StringIO
  from os import remove
  import pytest
  from unittest.mock import patch
  from datalad.api import install, run
  from datalad.core.local.run import run_command
  from datalad.core.local.tests.test_run import last_commit_msg
  from datalad.distribution.dataset import Dataset
  from datalad.local.rerun import diff_revision, get_run_info, new_or_modified
  from datalad.support.exceptions import CommandError, IncompleteResultsError
  from datalad.support.gitrepo import GitRepo
  from datalad.tests.utils_pytest import DEFAULT_BRANCH, DEFAULT_REMOTE, SkipTest, assert_dict_equal, assert_false, assert_in, assert_in_results, assert_not_in, assert_not_in_results, assert_raises, assert_repo_status, assert_result_count, assert_status, create_tree, eq_, known_failure_windows, neq_, ok_, ok_exists, ok_file_has_content, ok_file_under_git, skip_if_adjusted_branch, slow, swallow_logs, swallow_outputs, with_tempfile, with_tree
  from datalad.utils import Path, chpwd, on_windows
label_desc: Use image node_id 13 for calling a global function with example usage: test_new_or_modified(path) and returns: unknown