code: def check_replace_and_relative_sshpath(use_ssh, src_path, dst_path):
      # We need to come up with the path relative to our current home directory
      # https://github.com/datalad/datalad/issues/1653
      # but because we override HOME the HOME on the remote end would be
      # different even though a datalad-test. So we need to query it
      if use_ssh:
          from datalad import ssh_manager
  
          ssh = ssh_manager.get_connection("datalad-test")
          remote_home, err = ssh("pwd")
          remote_home = remote_home.rstrip("\n")
          dst_relpath = os.path.relpath(dst_path, remote_home)
          url = "datalad-test:%s" % dst_relpath
          sibname = "datalad-test"
      else:
          url = dst_path
          sibname = "local"
  
      ds = Dataset(src_path).create()
      create_tree(ds.path, {"sub.dat": "lots of data"})
      ds.save("sub.dat")
      res = ds.create_sibling(url, ui=have_webui())
      assert_in_results(
          res, action="create_sibling", sibling_name=sibname
      )
      published = ds.push(to=sibname, data="anything")
      assert_result_count(published, 1, path=opj(ds.path, "sub.dat"))
      if have_webui():
          # verify that hook runs and there is nothing in stderr
          # since it exits with 0 exit even if there was a problem
          out = Runner(cwd=opj(dst_path, ".git")).run(
              [_path_("hooks/post-update")], protocol=StdOutErrCapture
          )
          assert_false(out["stdout"])
          assert_false(out["stderr"])
  
      # Verify that we could replace and publish no problem
      # https://github.com/datalad/datalad/issues/1656
      # Strangely it spits outs IncompleteResultsError exception atm... so just
      # checking that it fails somehow
      res = ds.create_sibling(url, on_failure="ignore")
      assert_status("error", res)
      assert_in("already configured", res[0]["message"][0])
      # "Settings" such as UI do not persist, so we specify it again
      # for the test below depending on it
      with assert_raises(RuntimeError):
          # but we cannot replace in non-interactive mode
          ds.create_sibling(url, existing="replace", ui=have_webui())
  
      # We don't have context manager like @with_testsui, so
      @with_testsui(responses=["yes"])
      def interactive_create_sibling():
          ds.create_sibling(url, existing="replace", ui=have_webui())
  
      interactive_create_sibling()
  
      published2 = ds.push(to=sibname, data="anything")
      assert_result_count(published2, 1, path=opj(ds.path, "sub.dat"))
  
      # and one more test since in above test it would not puke ATM but just
      # not even try to copy since it assumes that file is already there
      create_tree(ds.path, {"sub2.dat": "more data"})
      ds.save("sub2.dat")
      published3 = ds.push(
          to=sibname, data="nothing"
      )  # we publish just git
      assert_result_count(published3, 0, path=opj(ds.path, "sub2.dat"))
  
      if not have_webui():
          return
  
      # now publish "with" data, which should also trigger the hook!
      # https://github.com/datalad/datalad/issues/1658
      from glob import glob
  
      from datalad.consts import WEB_META_LOG
  
      logs_prior = glob(_path_(dst_path, WEB_META_LOG, "*"))
      published4 = ds.push(to=sibname, data="anything")
      assert_result_count(published4, 1, path=opj(ds.path, "sub2.dat"))
      logs_post = glob(_path_(dst_path, WEB_META_LOG, "*"))
      eq_(len(logs_post), len(logs_prior) + 1)
  
      assert_postupdate_hooks(dst_path)
  
imports: import logging
  import os
  import stat
  import sys
  from os import chmod
  from os.path import basename, exists
  from os.path import join
  import pytest
  from datalad.api import create_sibling, install, push
  from datalad.cmd import StdOutErrCapture
  from datalad.cmd import WitlessRunner
  from datalad.distribution.create_sibling import _RunnerAdapter
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.exceptions import CommandError, InsufficientArgumentsError
  from datalad.support.gitrepo import GitRepo
  from datalad.support.network import urlquote
  from datalad.tests.utils_testdatasets import _mk_submodule_annex
  from datalad.tests.utils_pytest import DEFAULT_BRANCH, DEFAULT_REMOTE, SkipTest, assert_dict_equal, assert_false, assert_in, assert_in_results, assert_no_errors_logged, assert_not_equal, assert_not_in, assert_raises, assert_repo_status, assert_result_count, assert_status, create_tree, eq_, get_mtimes_and_digests, get_ssh_port, known_failure_windows, ok_, ok_endswith, ok_file_has_content, ok_file_under_git, skip_if_on_windows, skip_if_root, skip_ssh, slow, swallow_logs, with_tempfile, with_testsui
  from datalad.utils import Path, _path_, chpwd, on_windows
  from ..dataset import Dataset
label_desc: Use image node_id 11 for calling a global function with example usage: check_replace_and_relative_sshpath(use_ssh, src_path, dst_path) without return types