code: def history(
      config: Config,
      rev_range: Optional[str] = None,
      verbose: bool = False,
      indicate_current: bool = False,
  ) -> None:
      """List changeset scripts in chronological order.
  
      :param config: a :class:`.Config` instance.
  
      :param rev_range: string revision range
  
      :param verbose: output in verbose mode.
  
      :param indicate_current: indicate current revision.
  
      """
      base: Optional[str]
      head: Optional[str]
      script = ScriptDirectory.from_config(config)
      if rev_range is not None:
          if ":" not in rev_range:
              raise util.CommandError(
                  "History range requires [start]:[end], "
                  "[start]:, or :[end]"
              )
          base, head = rev_range.strip().split(":")
      else:
          base = head = None
  
      environment = (
          util.asbool(config.get_main_option("revision_environment"))
          or indicate_current
      )
  
      def _display_history(config, script, base, head, currents=()):
          for sc in script.walk_revisions(
              base=base or "base", head=head or "heads"
          ):
              if indicate_current:
                  sc._db_current_indicator = sc.revision in currents
  
              config.print_stdout(
                  sc.cmd_format(
                      verbose=verbose,
                      include_branches=True,
                      include_doc=True,
                      include_parents=True,
                  )
              )
  
      def _display_history_w_current(config, script, base, head):
          def _display_current_history(rev, context):
              if head == "current":
                  _display_history(config, script, base, rev, rev)
              elif base == "current":
                  _display_history(config, script, rev, head, rev)
              else:
                  _display_history(config, script, base, head, rev)
              return []
  
          with EnvironmentContext(
              config, script, fn=_display_current_history
          ):
              script.run_env()
  
      if base == "current" or head == "current" or environment:
          _display_history_w_current(config, script, base, head)
      else:
          _display_history(config, script, base, head)
  
imports: from __future__ import annotations
  import os
  from typing import List
  from typing import Optional
  from typing import TYPE_CHECKING
  from typing import Union
  from .None import autogenerate
  from .None import util
  from .runtime.environment import EnvironmentContext
  from .script import ScriptDirectory
label_desc: Use image node_id 9 for calling a global function with example usage: history(config, rev_range, verbose, indicate_current) and returns: list