def fetch_gerrit_hook_ssh(path, username, server, port=None):
    if port is None:
        port = 22
    git_hooks_dir = os.path.join(path, ".git", "hooks")
    # Create the dir if doesn't exist (otherwise scp won't create it)
    if not os.path.isdir(git_hooks_dir):
        qisys.sh.mkdir(git_hooks_dir)
    if sys.platform.startswith("win"):
        # scp on git bash does not handle DOS paths:
        git_hooks_dir = qisys.sh.to_posix_path(git_hooks_dir, fix_drive=True)
    scp = qisys.command.find_program("scp", raises=False)
    if not scp:
        return False, "Could not find scp executable"
    cmd = [scp, "-P" , str(port),
        "%s@%s:hooks/commit-msg" % (username, server),
        git_hooks_dir]
    process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    (out, _) = process.communicate()
    if process.returncode == 0:
        return True, ""
    else:
        return False, out
Test for a ObjectNotFound exception.
dataset/ETHPy150Open aldebaran/qibuild/python/qisrc/review.py/fetch_gerrit_hook_ssh--crossover with--dataset/ETHPy150Open lsbardel/python-stdnet/tests/all/query/manager.py/TestManager.test_get_error