code: def test_rerun_unrelated_nonrun_left_run_right(path=None):
      ds = Dataset(path).create()
      # keep direct repo accessor to speed things up
      ds_repo = ds.repo
      ds_repo.checkout(DEFAULT_BRANCH, options=["--orphan", "side"])
      ds.save(message="squashed")
      ds.run("echo foo >foo")
      ds_repo.checkout(DEFAULT_BRANCH)
      ds_repo.merge(
          "side",
          options=["-m", "Merge side", "--allow-unrelated-histories"],
      )
      # o                 d_n
      # |\
      # | o               c_r
      # | o               b_n
      # o                 a_n
  
      ds.rerun(since="", onto="")
      # o                 d_M
      # |\
      # | o               c_R
      # | o               b_n
      # o                 a_n
      ok_(ds_repo.commit_exists("HEAD^2"))
      neq_(ds_repo.get_hexsha(DEFAULT_BRANCH), ds_repo.get_hexsha())
      eq_(
          ds_repo.get_hexsha(DEFAULT_BRANCH + "^"),
          ds_repo.get_hexsha("HEAD^"),
      )
      eq_(
          ds_repo.get_hexsha(DEFAULT_BRANCH + "^2^"),
          ds_repo.get_hexsha("HEAD^2^"),
      )
      assert_false(ds_repo.commit_exists("HEAD^2^^"))
  
      ds_repo.checkout(DEFAULT_BRANCH)
      ds.rerun(since="", onto=DEFAULT_BRANCH + "^2")
      # o                 d_n
      # |\
      # | o               c_r
      # | o               b_n
      # o                 a_n
      eq_(ds_repo.get_hexsha(DEFAULT_BRANCH), ds_repo.get_hexsha())
      assert_false(ds_repo.commit_exists("HEAD^2^^"))
  
      ds_repo.checkout(DEFAULT_BRANCH)
      hexsha_before = ds_repo.get_hexsha()
      ds.rerun(since="")
      # o                 d_n
      # |\
      # | o               c_r
      # | o               b_n
      # o                 a_n
      eq_(hexsha_before, ds_repo.get_hexsha())
  
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 12 for calling a global function with example usage: test_rerun_unrelated_nonrun_left_run_right(path) without return types