code: def _revrange_as_results(dset, revrange):
      ds_repo = dset.repo
      rev_lines = ds_repo.get_revisions(
          revrange, fmt="%H %P", options=["--reverse", "--topo-order"]
      )
      if not rev_lines:
          return
  
      for rev_line in rev_lines:
          # The strip() below is necessary because, with the format above, a
          # commit without any parent has a trailing space. (We could also use a
          # custom `rev-list --parents ...` call to avoid this.)
          fields = rev_line.strip().split(" ")
          rev, parents = fields[0], fields[1:]
          res = get_status_dict(
              "run", ds=dset, commit=rev, parents=parents
          )
          full_msg = ds_repo.format_commit("%B", rev)
          try:
              msg, info = get_run_info(dset, full_msg)
          except ValueError as exc:
              # Recast the error so the message includes the revision.
              raise ValueError(
                  "Error on {}'s message".format(rev)
              ) from exc
  
          if info is not None:
              if len(parents) != 1:
                  lgr.warning(
                      "%s has run information but is a %s commit; "
                      "it will not be re-executed",
                      rev,
                      "merge" if len(parents) > 1 else "root",
                  )
                  continue
              res["run_info"] = info
              res["run_message"] = msg
          yield dict(res, status="ok")
  
imports: import json
  import logging
  import os.path
  import re
  import sys
  from copy import copy
  from functools import partial
  from itertools import dropwhile
  from datalad.consts import PRE_INIT_COMMIT_SHA
  from datalad.core.local.run import _format_cmd_shorty, assume_ready_opt, format_command, run_command
  from datalad.distribution.dataset import EnsureDataset, datasetmethod, require_dataset
  from datalad.interface.base import Interface, build_doc, eval_results
  from datalad.interface.results import get_status_dict
  from datalad.interface.common_opts import jobs_opt
  from datalad.support.constraints import EnsureNone, EnsureStr
  from datalad.support.exceptions import CapturedException
  from datalad.support.json_py import load_stream
  from datalad.support.param import Parameter
label_desc: Use image node_id 1 for calling a global function with example usage: _revrange_as_results(dset, revrange) without return types