code: def _commits(self, head='HEAD'):
          
          pending_commits = [head]
          history = []
          while pending_commits != []:
              head = pending_commits.pop(0)
              try:
                  commit = self[head]
              except KeyError:
                  raise KeyError(head)
              if type(commit) != Commit:
                  raise TypeError(commit)
              if commit in history:
                  continue
              i = 0
              for known_commit in history:
                  if known_commit.commit_time > commit.commit_time:
                      break
                  i += 1
              history.insert(i, commit)
              pending_commits += commit.parents
          return history
docs: Returns a list of the commits reachable from head.
  
          :return: List of commit objects. the first of which will be the commit
          of head, then following theat will be the parents.
  
          :raise: RepoError if any no commits are referenced, including if the
          head parameter isn't the sha of a commit.