code: def test_rerun_mutator_stem_nonrun_merges(path=None):
      ds = Dataset(path).create()
      # keep direct repo accessor to speed things up
      ds_repo = ds.repo
      ds.run("echo foo >>foo")
      with open(op.join(path, "nonrun-file0"), "w") as f:
          f.write("blah")
      ds.save()
      ds_repo.checkout(DEFAULT_BRANCH + "~", options=["-b", "side"])
      with open(op.join(path, "nonrun-file1"), "w") as f:
          f.write("more blah")
      ds.save()
      ds_repo.checkout(DEFAULT_BRANCH)
      ds_repo.merge("side", options=["-m", "Merge side"])
      # o                 e_n
      # |\
      # | o               d_n
      # o |               c_n
      # |/
      # o                 b_r
      # o                 a_n
  
      ds.rerun(since="", onto="")
      # o                 e_M
      # |\
      # | o               d_C
      # o |               c_C
      # |/
      # o                 b_R
      # o                 a_n
      ok_(ds_repo.commit_exists("HEAD^2"))
      neq_(ds_repo.get_hexsha(DEFAULT_BRANCH), ds_repo.get_hexsha())
  
      ds_repo.checkout(DEFAULT_BRANCH)
      ds.rerun(since="", onto=DEFAULT_BRANCH + "^2")
      # o                 c_C
      # o                 b_R
      # o                 d_n
      # o                 b_r
      # o                 a_n
      assert_false(ds_repo.commit_exists("HEAD^2"))
      eq_(
          ds_repo.get_hexsha("HEAD~2"),
          ds_repo.get_hexsha(DEFAULT_BRANCH + "^2"),
      )
  
      ds_repo.checkout(DEFAULT_BRANCH)
      hexsha_before = ds_repo.get_hexsha()
      ds.rerun(since="")
      # o                 b_R
      # o                 e_n
      # |\
      # | o               d_n
      # o |               c_n
      # |/
      # o                 b_r
      # o                 a_n
      eq_(hexsha_before, ds_repo.get_hexsha(DEFAULT_BRANCH + "^"))
      assert_false(ds_repo.commit_exists("HEAD^2"))
  
file_path: datalad/datalad/local/tests/test_rerun_merges.py
imports: import os.path
  from datalad.distribution.dataset import Dataset
  from datalad.tests.utils_pytest import DEFAULT_BRANCH, assert_false, eq_, neq_, ok_, skip_if_adjusted_branch, slow, with_tempfile
label_desc: Use image node_id 8 for calling a global function with example usage: test_rerun_mutator_stem_nonrun_merges(path) without return types