code: def test_GitRepo_get_revisions(path=None):
      gr = GitRepo(path, create=True)
  
      def commit(msg):
          gr.commit(msg=msg, options=["--allow-empty"])
  
      # We catch the error and return empty if the current branch doesn't have a
      # commit checked out.
      eq_(gr.get_revisions(), [])
  
      # But will raise if on a bad ref name, including an unborn branch.
      with assert_raises(CommandError):
          gr.get_revisions(DEFAULT_BRANCH)
  
      # By default, we query HEAD.
      commit("1")
      eq_(len(gr.get_revisions()), 1)
  
      gr.checkout("other", options=["-b"])
      commit("2")
  
      # We can also query branch by name.
      eq_(len(gr.get_revisions(DEFAULT_BRANCH)), 1)
      eq_(len(gr.get_revisions("other")), 2)
  
      # "name" is sugar for ["name"].
      eq_(
          gr.get_revisions(DEFAULT_BRANCH),
          gr.get_revisions([DEFAULT_BRANCH]),
      )
  
      gr.checkout(DEFAULT_BRANCH)
      commit("3")
      eq_(len(gr.get_revisions(DEFAULT_BRANCH)), 2)
      # We can pass multiple revisions...
      eq_(len(gr.get_revisions([DEFAULT_BRANCH, "other"])), 3)
      # ... or options like --all and --branches
      eq_(
          gr.get_revisions([DEFAULT_BRANCH, "other"]),
          gr.get_revisions(options=["--all"]),
      )
  
      # Ranges are supported.
      eq_(gr.get_revisions(DEFAULT_BRANCH + ".."), [])
  
imports: import logging
  import os
  import os.path
  import sys
  import pytest
  from datalad import get_encoding_info
  from datalad.cmd import StdOutCapture, StdOutErrCapture, WitlessRunner
  from datalad.support.exceptions import CommandError, FileNotInRepositoryError, InvalidGitRepositoryError, NoSuchPathError, PathKnownToRepositoryError
  from datalad.support.external_versions import external_versions
  from datalad.support.gitrepo import GitRepo, _normalize_path, normalize_paths, to_options
  from datalad.support.sshconnector import get_connection_hash
  from datalad.tests.utils_pytest import DEFAULT_BRANCH, DEFAULT_REMOTE, SkipTest, assert_cwd_unchanged, assert_equal, assert_false, assert_in, assert_in_results, assert_is_instance, assert_not_equal, assert_not_in, assert_raises, assert_repo_status, assert_true, create_tree, eq_, get_most_obscure_supported_name, integration, neq_, ok_, skip_if_no_network, skip_if_on_windows, skip_nomultiplex_ssh, slow, swallow_logs, with_tempfile, with_tree, xfail_buggy_annex_info
  from datalad.utils import Path, chpwd, getpwd, on_windows, rmtree
label_desc: Use image node_id 45 for calling a global function with example usage: test_GitRepo_get_revisions(path) without return types