def _rev_range(self, scope, srev_start=None, srev_end=None):
    '''Get all revisions in a range. Time direction is inferred. Either or both may be None.'''
    rev_start = self.resolve_rev(scope, srev_start) if srev_start else srev_start
    rev_end = self.resolve_rev(scope, srev_end) if srev_end else srev_end

    all_revs = self.get_revs(scope)

    if not all_revs:
      raise InvalidArgument("unknown scope: '%s'" % scope)

    # Default is to go backward in time through whole list
    if not rev_start and not rev_end:
      rev_start_index = len(all_revs) - 1
      rev_end_index = 0
    if rev_start:
      try:
        rev_start_index = all_revs.index(rev_start)
      except ValueError, e:
        raise InvalidArgument("unknown revision %s for scope '%s'" % (rev_start, scope))
      # If rev_start is set and not rev_end, go backward in time ("tip:" is backwards from tip)
      if not rev_end:
        rev_end_index = 0
    if rev_end:
      try:
        rev_end_index = all_revs.index(rev_end)
      except ValueError, e:
        raise InvalidArgument("unknown revision %s for scope '%s'" % (rev_end, scope))
      # If rev_end is set and not rev_start, go forward in time (":tip" is forwards from start)
      if not rev_start:
        rev_start_index = 0

    log.debug("log for revs %s through %s (indices %s through %s out of %s)", rev_start, rev_end, rev_start_index, rev_end_index, len(all_revs))
    if rev_start_index <= rev_end_index:
      revs = all_revs[rev_start_index : rev_end_index + 1]
    else:
      revs = reversed(all_revs[rev_end_index : rev_start_index + 1])

    return revs
dataset/ETHPy150Open bloomreach/zinc/zinc.py/Repo._rev_range/original